Create UNC path shortcut to machine which is offline

On Windows, I am adding shortcuts (.lnk files) to the desktop for various other machines on the network. So for example the “MYMACHINE.lnk” properties shows “Target: \MYMACHINE“.

But I can only create the shortcut if the destination machine is turned on and reachable. If it is not then the process hangs forever and no shortcut is created.

I tried the simple

  • right-click on the Desktop
  • New -> Shortcut
  • And in “Type the location of the item:”, giving \MYMACHINE

And I also tried this at the command line:

SET TO=mymachine
SET NAME=mymachine
powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%userprofile%Desktop%NAME%.lnk'); $s.TargetPath='\%TO%'; $s.Save()"

But both methods don’t work if the destination computer is currently turned off.

Is there a workaround to create the link anyway, without having to go to each destination machine to turn it on?