title: PowerShell Create Folder on Remote Server
body: <p>The following script does not add a folder to my remote server.  Instead it places the folder on My machine!  Why does it do it?  What is the proper syntax to make it add it?</p>
  
  <pre><code>$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
  
  }
  </code></pre>