Find Jobs
Hire Freelancers

create powershell script to get result of get-wmiobject with if and elsif statement

$10-30 USD

Closed
Posted over 5 years ago

$10-30 USD

Paid on delivery
hello I want to use get-wmiobject to totalphysicalmemory, and numberofcores, and array contain several processes should be compared with get-process result they should be two conditions true or false for example if totalphysical memory =< 20158 MB the script should exit if the numberofcore =< 2 the script should exit otherwise it will contiue I already coded some lines but of course need fine-tune please find the code below ------------CODE START HERE------------------ $CPU = get-wmiobject -class win32_processor | select-object -property NumberOfCores #$Mem = get-wmiobject -computer localhost win32_computersystem | select-object @{n="";e={[math]::truncate($[login to view URL] / 1MB)}} Foreach ($D in $CPU) { $CPU = $[login to view URL] If ($[login to view URL] -le $2) {Write-Host "$denied"} Sleep 5 Elseif #$Mem = $[login to view URL] ($[login to view URL] -le $2048) {Write-Host "$denied"} Sleep 5 Else {Write-Host "$success"} } @("[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]","[login to view URL]") | Foreach-object { if((Get-Process $_ -ErrorAction SilentlyContinue) -eq $null) {Write-Host "$success"} else {Write-Host "$denied"} end if ------CODE END HERE-----
Project ID: 17781908

About the project

7 proposals
Remote project
Active 5 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
7 freelancers are bidding on average $24 USD for this job
User Avatar
Hello I have extensive experience with WMI and powershell. I am sure this project is just piece of cake for me.
$25 USD in 1 day
4.9 (1976 reviews)
8.1
8.1
User Avatar
Hello Mr. I can help you with this powershell script. I would like to know more about this project. contact me by chat to get more information. Best Regards
$30 USD in 3 days
5.0 (53 reviews)
5.2
5.2

About the client

Flag of LEBANON
Beirut, Lebanon
0.0
0
Member since Sep 16, 2018

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.