以下脚本不会将文件夹添加到远程服务器。相反,它将文件夹放在我的机器上!它为什么这样做?什么是适当的语法,使其添加?PowerShell在远程服务器上创建文件夹
$setupFolder = "c:\SetupSoftwareAndFiles"
$stageSrvrs | ForEach-Object {
Write-Host "Opening Session on $_"
Enter-PSSession $_
Write-Host "Creating SetupSoftwareAndFiles Folder"
New-Item -Path $setupFolder -type directory -Force
Write-Host "Exiting Session"
Exit-PSSession
}