Powershell Admin Scripts

To get the process owner.

(Get-WmiObject win32_process | where{$_.Name -eq ‘explorer.exe’}).getowner() | Select  domain, user

To find the systems that are alive

$result = Get-WmiObject -query “select * from win32_pingstatus where address=’google.com’ ”
if ($result.StatusCode -eq 0)
{echo “google.com is alive”}
else
{echo “google.com is not pingable”}

Leave a comment

Your email address will not be published. Required fields are marked *

WordPress Appliance - Powered by TurnKey Linux