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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s