I am currently in the process of deploying Windows 7 to a variety of PCs (Very new to powershell). The deployment its self is successful, however throughout the task sequence there is a specific step in which a shortcut must be created. After the deployment is complete there is no error or issue to say that the script had not been successful yet, it clearly has not worked. The shortcut is located on a server, but the step within the task sequence is run with the network administrator account, so I doubt it is a permission issue. If you run the script within PowerShell once Windows is installed it works correctly creating the shortcut to the application. If anyone has had a similar experience or any information which may help then I'd appreciate your input.
This is the command line sequence that is used within the task sequence:
powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden -File .\AppShortcut.ps1
This is the actual powershell script.
$AppLocation = "\PROGRAM\Testprogram\TestApp\App.exe"
$WshShell = New-Object -ComObject WScript.Shell
$desktop = $wshShell.SpecialFolders.Item("AllUsersDesktop")
$Shortcut = $WshShell.CreateShortcut($desktop + "\App.lnk")
$Shortcut.TargetPath = $AppLocation
$Shortcut.IconLocation = "\PROGRAM\Testprogram\TestApp\App.exe"
$Shortcut.WorkingDirectory ="\PROGRAM\Testprogram\TestApp\"
$Shortcut.Save()