Managing remote windows box


I will have this 1 post for all useful commands.

Rebooting remote windows box

(gwmi win32_operatingsystem -Computername XXXXXXX -cred (get-credential)).Win32Shutdown(6)

Please check also http://msdn.microsoft.com/en-us/library/windows/desktop/aa394058%28v=vs.85%29.aspx to see possible flags you can set for the reboot.

Checking uptime of a remote windows box, for example after the reboot

[Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject Win32_OperatingSystem -Computername XXXXXX -cred (get-credential)).LastBootUpTime)

Checking network configuration of a remote windows box

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName XXXXXX –Cred  (get-credential) | select IPSubnet,DefaultIPGateway,WINSPrimaryServer,WINSSecondaryServer,IPAddress,DNSServerSearchOrder

I will try to update this post each time i find something useful.

Advertisements

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