Files
management-scripts/Fix-AutodeskProductLicensing.ps1
2023-11-01 15:33:03 -04:00

30 lines
1.4 KiB
PowerShell

#. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1')))
# https://www.autodesk.com/support/technical/article/caas/tsarticles/ts/6IFPpIksTDfsCzp1JwIH5k.html
$URL = 'https://damassets.autodesk.net/content/dam/autodesk/external-assets/support-articles/licensing-support-tool/AdskLicensingSupportTool-2.3.0.692-win.zip'
# Download the zip archive
$LicensingSupportTool = Download-File -URL $URL
# Extract the downloaded zip file
Expand-Archive -Path $LicensingSupportTool
$WorkingDir = '{0}\{1}' -f (Split-Path -Path $LicensingSupportTool -Parent), "AdskLicensingSupportTool"
$ALST = "${WorkingDir}\AdskLicensingSupportTool.exe"
If ( Test-Path $ALST ) {
Write-Output "Resetting all Autodesk product licenses to named-user licenses"
Try { Start-Process $ALST -ArgumentList '-r ALL:User' -Wait }
Catch { Write-Error $_.Exception.Message }
}
If ( Test-Path $LicensingSupportTool ) {
Write-Output "Deleting ""${LicensingSupportTool}"""
Try { Remove-Item $LicensingSupportTool -Force -ErrorAction SilentlyContinue }
Catch { Write-Error $_.Exception.Message }
}
If ( Test-Path $WorkingDir ) {
Write-Output "Deleting ""${WorkingDir}"""
Try { Remove-Item $WorkingDir -Force -Recurse -ErrorAction SilentlyContinue }
Catch { Write-Error $_.Exception.Message }
}