Enter-PSSession can only be used in interactive remote mode. You cannot use it as part of a script block. Use the Invoke-Command command instead:
$stageSvrs | %{ Invoke-Command -ComputerName $_ -ScriptBlock { $setupFolder = "c:\SetupSoftwareAndFiles" Write-Host "Creating SetupSoftwareAndFiles Folder" New-Item -Path $setupFolder -type directory -Force Write-Host "Folder creation complete" } }
ravikanth
source share