AnoopGeorge.com

Rename Local Administrator Password

here is a script to rename the local administrator password using powershell… it renames the administrator account to the “!computerName”…

Remember to run powershell as administrator.

$Bang = “!”
$NewComputerName = gc env:computername
$NewAdminAccount = $Bang+$NewComputerName $admin = [ADSI]“WinNT://./Administrator,user” $admin.psbase.Rename(“$NewAdminAccount”)

Read More

powershell ping test

A way to test to see if the server is pingable

PS > # Using .NET method to ping test the servers
PS > $ping = new-object System.Net.NetworkInformation.Ping
PS > $ping.send($strComputer)

Status        : Success
Address       : 192.168.1.1
RoundtripTime : 0
Options       : System.Net.NetworkInformation.PingOptions
Buffer        : {97, 98, 99, 100…}

 

# Using .NET method to ping test the servers
$ping = new-object System.Net.NetworkInformation.Ping

$Reply = $ping.send($strComputer)
if($Reply.status -eq “success”)
{
#Do something here …
}

Read More