Hi
I would like to set the time on remote machines joined to a domain.
I only want it to only apply to machines turned on.
I am getting these errors when I run the script below
CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : InvalidResourceUri,PSSessionOpenFailed
The WS-Management service cannot process the request. Cannot find the Microsoft.PowerShell session configuration in the WSMan
import-module ActiveDirectory
$Computers = Get-ADcomputer -filter {OperatingSystem -NotLike "*server*"}
foreach ($Computer in $Computers)
{
$name = $computer.Name
if (Test-Connection -Computername $name -BufferSize 16 -Count 1 -quiet )
{
$Session= New-PSSession -computername $name -authentication Kerberos
Invoke-Command -ComputerName $name -script {NET TIME /DOMAIN:TEST /set /yes}}
Remove-PSSession $Session
}
Thank you in advance