title: Trying to make a symbolic link to a Powershell script on a remote server
body: <p>I'm trying to create a symbolic link with mklink through a Powershell script to a Powershell script on a remote server. This link should come on the desktop of all users.
  Becasue I have 2003 and 200! servers i first check if the patch exists..</p>
  
  <pre><code>if(!(test-path -path \$hostname\c$\Users)) {
      Copy-Item `
              -Path "\dsfpad\Nagios\Nagios_Downtime\Nagios - Schedule Downtime.lnk" `
              -Destination "\$hostname\c$\Documents and Settings\All Users\Desktop\Nagios - Schedule Downtime.lnk";
      } else {
          $s=New-PSSession -ComputerName $hostname Enter-PSSession $s;
          Invoke-Command -Session $s -ScriptBlock {
  &amp; cmd /c mklink "C:\Users\Public\Desktop\Nagios - Schedule Downtime.lnk" "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -file c:\Nagios\Nagios_Downtime_Window_NRDP.ps1"
          }
          exit-pssession;
          remove-pssession $s;
      }
  </code></pre>
  
  <p>I get symbolic link created for <code>C:\Users\Public\Desktop\Nagios - Schedule Downtime.lnk</code> &lt;&lt;===>> <code>C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -file c:\Nagios\Nagios_Downtime_Window_NRDP.ps1</code></p>
  
  <p>But when I try to execute the link on a server, it doesn't work. looking at the Target of the link, there seems to be no target.</p>
  
  <p>It seems when i don't use <code>C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -file</code> in the target, I do get a target in the lnk file, but it does not execute the script.</p>
  
  <p>Any tips / ideas?</p>