Renew IP on Machines Remotely with Powershell Invoke-Command

Import-Module activedirectory
$XDMachines = Get-ADComputer -LDAPFilter "(name=*)"-SearchBase 
"OU=XenDesktop-VMs,OU=WorkStations,DC=mulpuru,DC=local" 
foreach ($XDMachine in $XDMachines)
{
    
    if(Test-Connection -ComputerName $XDMachine.Name -Quiet -Count 1)
    {
    
        Invoke-Command -ComputerName $XDMachine.Name -ScriptBlock {
        ipconfig /renew}
    }

}

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