Files
management-scripts/Fix-AutodeskProductLicensing.ps1
T

30 lines
1.3 KiB
PowerShell

. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1')))
# https://knowledge.autodesk.com/search-result/caas/downloads/content/licensing-support-tool.html
$URL = 'https://knowledge.autodesk.com/sites/default/files/file_downloads/AdskLicensingSupportTool-2.2.0.502-win.zip'
# Download the zip archive
$LicensingSupportTool = Download-File -URL $URL
# Extract the downloaded zip file
Unzip-Object $LicensingSupportTool
$WorkingDir = '{0}\{1}' -f (Split-Path -Path $LicensingSupportTool -Parent), "AdskLicensingSupportTool"
$ALST = "${WorkingDir}\AdskLicensingSupportTool.exe"
If ( Test-Path $ALST ) {
LogMsg "Resetting all Autodesk product licenses to named-user licenses"
Try { Start-Process $ALST -ArgumentList '-r ALL:User' -Wait }
Catch { LogErr $_.Exception.Message }
}
If ( Test-Path $LicensingSupportTool ) {
LogMsg "Deleting ""${LicensingSupportTool}"""
Try { Remove-Item $LicensingSupportTool -Force -ErrorAction SilentlyContinue }
Catch { LogErr $_.Exception.Message }
}
If ( Test-Path $WorkingDir ) {
LogMsg "Deleting ""${WorkingDir}"""
Try { Remove-Item $WorkingDir -Force -Recurse -ErrorAction SilentlyContinue }
Catch { LogErr $_.Exception.Message }
}