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 comment

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

WordPress Appliance - Powered by TurnKey Linux