Jump to content

TomTCC

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by TomTCC

  1. Success! I have finally managed to write a Powershell script that will install or update Fusion 360, regardless on whether or not it has been deployed previously. Many thanks @robyholmes for posting the vbs script, this was an invaluable starting point Feel free to use the following: #Fusion 360 Powershell Script # #This script will install or update Fusion 360, whether it has been installed previously or not. #There is a naming convention that needs to be applied to make sure this script works. Please use the following example as a guide on how to name your Fusion installer executables: #The latest Version of Fusion as of 27/11/19 is 2.0.6613, therfore the file name would be "Fusion_360_2_0_6613.exe". #The reason the naming convention is so important, is to do with the Registry Key it writes to enable version checking of the software. #Sets variables for installed application path and it's name. $LauncherBasePath = "C:\Program Files\Autodesk\webdeploy\Production\" $LauncherName = "FusionLauncher.exe" #Sets variable for installer file path location. $InstallerPath = "" #Sets variable to retrieve the latest file (this assumes that historic versions of the application are stored in the same location). $Executable = Get-ChildItem -Path $InstallerPath -Filter "*.exe" | Sort-Object LastWriteTime | Select -Last 1 #Sets variable as the name of the installer executable. $ExeName = $Executable.Name #Due to file naming convention, this removes the underscores and file extention from the file name. $LatestVersion = ($ExeName).Replace("Fusion_360_","").Replace(".exe","").Replace("_",".") #Sets variables for the Reg Key path and it's name. $Keypath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Fusion 360 CAM" $KeyValue = "Version" #Outputs a true/false result if Reg Key exists. $TestKeyValuePath = Get-ItemProperty -path "$KeyPath" -Name "$KeyValue" -ErrorAction SilentlyContinue #Test for a positive result that the application and Reg Key are present. If (($TestKeyValuePath) -and ([bool](GCi $LauncherBasePath -Filter $LauncherName -Recurse -File -Depth 1 -ErrorAction SilentlyContinue).Fullname)) { #Sets variable to output the Reg Key's value in a form that can be compared to the file version value. $CurrentVersion = (Get-ItemProperty -path "$KeyPath" -Name $KeyValue).$KeyValue #Checks file version against version in Reg Key for a lower value. If ([Version]$CurrentVersion -lt [Version]$LatestVersion) { #If the Reg Key value is lower than the installer's version value, it will update the Reg Key and the application. Set-ItemProperty -Path $KeyPath -Name $KeyValue -Value $LatestVersion Start-Process -FilePath ($Executable.FullName) -ArgumentList " --process update --quiet" -NoNewWindow -Wait } } #If the above the conditions are not met, the following occurs. Else { #Tests for a positive result that the application is present and the Reg Key is not. If true, the application will uninstall, the script will then continue to the next If statement. If (([bool](GCi $LauncherBasePath -Filter $LauncherName -Recurse -File -Depth 1 -ErrorAction SilentlyContinue).Fullname) -and (!($TestKeyValuePath))) { Start-Process -FilePath ($Executable.FullName) -ArgumentList " --process uninstall --quiet" -NoNewWindow -Wait } #Tests for a positive result that the application is not present, and the Reg Key is. If true, the Reg Key will be removed, the script will then continue to the next If statement. If ((!([bool](GCi $LauncherBasePath -Filter $LauncherName -Recurse -File -Depth 1 -ErrorAction SilentlyContinue).Fullname)) -and ($TestKeyValuePath)) { Remove-ItemProperty -Path $KeyPath -Name $KeyValue } #Tests for a positive result that both the application and Reg Key are not present. If true, the application will be installed and a Reg key created. If ((!([bool](GCi $LauncherBasePath -Filter $LauncherName -Recurse -File -Depth 1 -ErrorAction SilentlyContinue).Fullname)) -and (!($TestKeyValuePath))) { New-Item -Path $KeyPath -Force New-ItemProperty -Path $KeyPath -Name $KeyValue -Value $LatestVersion Start-Process -FilePath ($Executable.FullName) -ArgumentList " --quiet" -NoNewWindow -Wait } }
  2. @Sephiroth Any chance you could let me know the process? I have been running into a bit of a wall on this one. I've managed to get it to install, but each time the computer powers on, it tries to install Fusion again. I have also not been able to get it to uninstall when GP is removed. Any advice you could give would be greatly appreciated.
×
×
  • Create New...