# Powershell script to create shortcut to vision application?

**URL:** <https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [July 29, 2024, 4:28pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848 "2024-07-29T16:28:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 29, 2024, 4:28pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848/1 "2024-07-29T16:28:48Z")

</div>

I have a customer with many client computers that wants to automate the installation process. Using powershell and this link - [Launchers and Workstation | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/launchers-and-workstation)

I was able to download and silently install vision client launcher fine. This works fine but the last step I cannot find in this documentation and hopefully is possible is for the vision client launcher to manually add a gateway, add an application from the gateway and create a shortcut for that application. Is this doable?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 29, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848/2 "2024-07-29T17:01:25Z")

</div>

You would have to write a json config file with the gateway & application information to the user's home directory. Then write a shortcut link on the desktop that calls the launcher with that app name as a parameter. I would expect PowerShell to easily handle those tasks.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 29, 2024, 5:03pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848/3 "2024-07-29T17:03:13Z")

</div>

> [@pturmel](#):
>
> You would have to write a json config file ... then write a shortcut link on the desktop that calls the launcher with that app name as a parameter.

I'd probably create those on one machine, then copy those into the installation procedure.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 29, 2024, 5:03pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848/4 "2024-07-29T17:03:30Z")

</div>

Thanks, I did find this post helpful [How to Deploy Vision Client Launcher - #7 by Jonathan](https://forum.inductiveautomation.com/t/how-to-deploy-vision-client-launcher/40547/7)

I found the right JSON file from a existing machine . Now am just working on the shortcut aspect.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 29, 2024, 5:36pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848/5 "2024-07-29T17:36:11Z")

</div>

I'll note that what you're trying to do is going to be made a lot easier in 8.3, and as far as I know the new launchers for 8.3 will be backwards compatible with (most) older 8.1 gateways.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 29, 2024, 6:17pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848/6 "2024-07-29T18:17:37Z")

</div>

I tried my best but the shortcut is not working. A few things I noted - in a manually made shortcut I see the target as the `C:\...\visionclientlauncher.exe -Dapplication=app` and the `Start In` ($shortcut.WorkingDirectory) is filled in but whne I Try to do that it makes the shortcut not do anything. Here was the closest I Think I got - but it just opens up the vision client launcher. I don't believe my "configuring vsc" part right after the vision client launcher install does anything.

```python
# Constants
$ip="192.168.1.100"
$downloadAddress="http://$ip/system/nativelaunch?type=vision&os=windows"

# Copy json launcher file
# Putting it in clientlauncher-data bricked my whole launcher
#$localConfigFolder= [System.IO.Path]::Combine([System.Environment]::GetFolderPath("UserProfile"),".ignition","clientlauncher-data")
#$localJsonConfig = [System.IO.Path]::Combine($localConfigFolder, "vision-client-launcher.json")
$localConfigFolder="C:\app"
$localJsonConfig=[System.IO.Path]::Combine($localConfigFolder,"app.json")
$networkJsonConfig = "Z:\app.json"

if (-not (Test-Path $localConfigFolder)) {
    New-Item -ItemType Directory -Path $localConfigFolder
}

Copy-Item -Path $networkJsonConfig -Destination $localJsonConfig -Force

# Get the current user's Downloads folder
$downloadPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath("UserProfile"), "Downloads", "downloadedFile.exe")

# Path to single user executable
$workingDir = [System.IO.Path]::Combine([System.Environment]::GetFolderPath("UserProfile"),"AppData","Roaming","Inductive Automation", "Vision Client Launcher")
$singleUserExe = [System.IO.Path]::Combine($workingDir,"visionclientlauncher.exe")

# Download and install launcher if needed
if (-not (Test-Path $singleUserExe)) {
    Write-Output "Downloading Vision client launcher..."
    # Download the file
    Invoke-WebRequest -Uri $downloadAddress -OutFile $downloadPath
    Write-Output "Installing Vision Client Launcher..."
    $arguments = "/CURRENTUSER /VERYSILENT"
    Start-Process -FilePath $downloadPath -ArgumentList $arguments -NoNewWindow -Wait
    Write-Output "Configuring vsc"
    Start-Process -FilePath $singleUserExe -ArgumentList "config.json=$jsonConfig" -NoNewWindow -Wait
}

# Make shortuct
$shortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath("Desktop"), "App.lnk")
$WScriptShell = New-Object -ComObject WScript.Shell
$shortcut = $WScriptShell.CreateShortcut($shortcutPath)
$shortcut.TargetPath = $singleUserExe
# Though a manual made shortcut that works has the workingdirectory filled out, if I do it, it bricks the shorcut
#$shortcut.WorkingDirectory=$workingDir
$shortcut.Arguments="config.json=$localJsonConfig"
$shortcut.Save()

Write-Output "Process Complete"

```

Can someone help me with this?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 29, 2024, 6:54pm UTC](https://forum.inductiveautomation.com/t/powershell-script-to-create-shortcut-to-vision-application/93848/7 "2024-07-29T18:54:41Z")

</div>

Just re-read this and I got it thanks. I did need to modify the `C:\Users\...\vision-client-launcher.json` and then use `-Dapplication=app` as my argument for in my target and it worked fine along with the right working directory.

What was confusing me was when I made a connection on the gateway just to see how things were supposed to be done I was exporting this -  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/8/98cb5689e4146d545b7e8d2305db19fcf0ed7dc5.png)

Getting json and referring to that and it was doing nothing, but that's not the JSON I needed. The one I needed was from Vision client launcher - settings -  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/d/cd8ed98b7302dd5d9c75ae512afc170f2e50a3ac.png)

Export Launcher Config (after making the connection to the gateway/project)
