title: Run .ps1 on remote machine
body: <p>I need to execute powershell script on remote computer with admin privilegies.
  I have 2 scripts: client and server.
  When i start client.ps1 i invoke command on server machine but get access error. I get no error if I use simple code in server.ps1 like write-host "hello".</p>
  
  <p>server.ps1:</p>
  
  <pre><code> Get-service -ComputerName 'client'
  </code></pre>
  
  <p>client.ps1:</p>
  
  <pre><code>$ScriptBlockContent = { 
          d:\server.ps1
          }
  $remote=New-PSSession -ComputerName 'server'
  Invoke-Command $remote -ScriptBlock $ScriptBlockContent
  </code></pre>