Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Create shortcut using Powershell

$
0
0

I am trying to make a PoSH script to create shortcuts for a bunch of Autodesk deployments, and seem to be running into an issue. I am pretty sure I am having issues escaping the "/" character properly.

Here is the error I am getting:

Exception setting "TargetPath": "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"

At Z:\Scripts\Powershell\CFG_CREATE_ACALNK.ps1:15 char:1

+ $Shortcut.TargetPath = $varTargetPath

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException

+ FullyQualifiedErrorId : CatchFromBaseAdapterSetValueTI

Here is a copy of my script:

$varServer = "TESTFILE"

$varPath1 = "`"\\$varServer\Install\Applications\Autodesk\Autodesk Network License\Network2016\Img\Setup.exe`""

$varPath2 = " /I "

$varPath3 = "\\$varServer\Install\Applications\Autodesk\Autodesk...


Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>