Advertisement
Cogger

Transit Autodesk License to User License.ps1

May 25th, 2022
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # https://github.com/mohammedha/Posh/blob/main/Autodesk/Transit%20Autodesk%20License%20to%20User%20License.ps1
  2. <#
  3.     .Synopsis
  4.         Configure Autodesk products license to named USER license
  5.     .DESCRIPTION
  6.         This script will convert Autodesk licenses to the new Autodesk license model "Named Licenses" for all install Autodesk products.
  7.     .OUTPUTS
  8.         Text file "LicenseReset.txt" with the tool output.
  9.     .FUNCTIONALITY
  10.        This script will convert Autodesk licenses to the new Autodesk license model "Named Licenses" for all install Autodesk products,
  11.        it will...
  12.        - Download AdskLicensingSupportTool
  13.        - Run "AdskLicensingSupportTool.exe"
  14.        - Create a txt file "LicenseReset.txt" with all tool output.
  15.        - If the tool ran before and "LicenseReset.txt" exist it will not run again [to force running the tool again just delete the TXT file]
  16.     .NOTES
  17.        Written by Mohamed Hassan
  18.        I take no responsibility for any issues caused by this script, you should not run any code you dont understand.
  19.     .LINK
  20.        https://github.com/mohammedha/Posh
  21.     #>
  22.  
  23. # Check if Elevated
  24. $WindowsIdentity = [system.security.principal.windowsidentity]::GetCurrent()
  25. $Principal = New-Object System.Security.Principal.WindowsPrincipal($WindowsIdentity)
  26. $AdminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator
  27.  
  28. if ($Principal.IsInRole($AdminRole)) {
  29.     Write-Host -ForegroundColor Green "Elevated PowerShell session detected. Continuing."
  30. }
  31. else {
  32.     Write-Host -ForegroundColor Red "Autodesk License Support Tool must be run in an elevated PowerShell window. Please launch an elevated session and try again."
  33.     Break
  34. }
  35.  
  36. #Variable
  37. $ResetFile = "C:\Autodesk\AdskLicensingSupportTool\LicenseReset.txt"
  38. $ADSKFolder = "C:\Autodesk\"
  39. $SupportToolFolder = "C:\Autodesk\AdskLicensingSupportTool"
  40. $SupportTool = "adsklicensingsupporttool-2.0.0.364-win.zip"
  41.  
  42. # Script
  43. if (!(Test-Path -path $ResetFile)) {
  44.     # Create Autodesk if doesn't exist
  45.     if (!(Test-Path $ADSKFolder)) {
  46.         Write-Information -MessageData "Creating Autodesk folder..." -Verbose -InformationAction Continue
  47.         New-Item -ItemType Directory -Name Autodesk -Path "C:"
  48.     }
  49.     else {
  50.         Write-Information "$ADSKFolder Does Exist - OK" -verbose -InformationAction Continue
  51.     }
  52.     # Download/Extract ADSK tool
  53.     Set-Location -Path $ADSKFolder
  54.     Invoke-WebRequest -Uri https://download.autodesk.com/us/support/files/AdskLicensingSupportTool/adsklicensingsupporttool-2.0.0.364-win.zip -OutFile "adsklicensingsupporttool-2.0.0.364-win.zip"
  55.     Expand-Archive -Path $SupportTool -Force
  56.     Move-Item -LiteralPath "C:\Autodesk\adsklicensingsupporttool-2.0.0.364-win\AdskLicensingSupportTool" -Destination $ADSKFolder -Force
  57.     Set-Location -Path $SupportToolFolder
  58.     # Converting ADSK Products to Named User licenses [To convert to Network license replace USER with NETWORK [case sensitive]]
  59.     cmd /k "AdskLicensingSupportTool.exe -r All:USER >>LicenseReset.txt"
  60.     exit
  61. }
  62. else {
  63.     Write-Information "AdskLicensingSupportTool Already Ran on this machine" -verbose -InformationAction Continue
  64.     exit
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement