Important Notice: On February 29th, this community will be put into read-only mode. All existing posts will remain but customers will be unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

shortcut for rpd with IP prepopulated

Hey all having some issues trying to make a script to create an RDP shortcut on the public desktop with the IP address pre populated when i click on the short cut its telling me invalid connection file specified (same message if i used host name or IP ) here's the script I'm working with

 

$wshshell = New-Object -ComObject WScript.Shell
$lnk = $wshshell.CreateShortcut("C:\Users\Public\Desktop\RDP Shortcut name.lnk")
$lnk.TargetPath = "%windir%\system32\mstsc.exe"
$lnk.Arguments = "/v:$ IP address or host name here"
$lnk.Description = "RDP!"
$lnk.Save()

0

Comments

1 comment
Date Votes
  • I recommend manually creating the shortcut once, then copying it to each target with a File Copy step.

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post