0

I am not at all versed in PowerShell, but I am trying to use it nonetheless. I am working to automate an OS build for my IT department and I have almost everything done except for the creation of shortcuts. I found this topic: How to run a PowerShell script from a batch file that told me how I could use PowerShell to do this.

When I run this command (saving to the default user profile's desktop) It throws an error.


POWERSHELL:

$WshShell = New-Object -comObject WScript.Shell

$Shortcut = $WshShell.CreateShortcut("C:\Users\Default\Desktop\ReadMe.lnk")

$Shortcut.TargetPath = "C:\Program Files (x86)\Adobe\Acrobat 10.0\ReadMe.htm"

$Shortcut.Save()

COMMAND:

Powershell.exe -executionpolicy remotesigned -File "C:\Users\trw68319\Desktop\Powershell Shortcuts.ps1"

enter image description here


I suspect this is due to the fact that the default user is a hidden directory (I tried this with a different directory and it worked). Could anyone please tell me if it is possible to complete this task while saving to the default (hidden) user directory?

Thanks

Community
  • 1
  • 1

0 Answers0