powershell remote
问题 I am trying to run this from my local machine (Win7 & PS v2.0) cls $sess = Enter-PSSession -ComputerName blmcrmpoc Invoke-Command -Session $sess -Scriptblock { $path = "C:\inetpub\logs\LogFiles" $lastWrite = (Get-Date).AddDays(-90) $oldLogs = Get-ChildItem -path $path -Recurse -Filter *.log | Where {$_.LastWriteTime -le $lastWrite} if ($oldlogs.count -gt 0) {foreach ($log in $oldLogs) {$log.Delete()}}} But I get this error. ***Invoke-Command : Cannot validate argument on parameter 'Session'.