Installing Civil 3D 2024 using PowerShell

Installing Civil 3D 2024 using PowerShell

c-smoll
Explorer Explorer
980 Views
3 Replies
Message 1 of 4

Installing Civil 3D 2024 using PowerShell

c-smoll
Explorer
Explorer

I'm working on a PowerShell script to install/upgrade computers to Civil 3D 2024. 

 

The major issue I'm encountering revolves around removing existing versions of C3D. For our application, we cannot have multiple versions of C3D on a computer, so I have to be rid of any version prior to the current one. 

 

If there's no previously existing install of C3D (any version), install works as intended and indeed works quite well. 

 

Where the problem occurs is if some version is already installed be it 2023 or 2024. 

 

My script searches the uninstall keys portion registry for applications having "Civil 3D" in their Display Name. Anything it finds, it loads the related uninstall string into an array followed by running each uninstall string, waiting until the process completes before performing any remaining uninstall string. 

 

The script has no difficulty obtaining the uninstall strings and runs them without issue. Except for one crucial problem.

 

Nothing actually uninstalls. Nothing! Doesn't matter if the software uses MSIEXEC or AdODIS, nothing gets uninstalled. I know the method for obtaining uninstall strings and executing them works, the code works without fail for other manufacturer's products with only the search string changed. But not the Autodesk.

 

Because the issue is not limited to AdODIS and includes MSIEXEC, I hesitate to say it's an Autodesk problem. At the same time, the code works for other non-Autodesk software. 

 

I'll readily admit I'm not any kind of expert on PowerShell so I expect (hope?) somebody will point out a silly syntax error causing all my problems. 

 

Two final details, while the script is intended to run from SCCM I have a batch file which issues the same commands SCCM would use and I do run it as administrator. I've attached a copy of my script with a TXT extension appended. If you want to run it, just remove the .txt extension. 

 

Thanks!

0 Likes
981 Views
3 Replies
Replies (3)
Message 2 of 4

TravisNave
Mentor
Mentor

Powershell has a better uninstall tool built-in that you do not have to script.  Just use the uninstall-Package command.  You can use the Get-Package command first to find the name of the products listed.  But you'd probably just be able to do a wildcard to match all the Civil 3D versions that you have.  I don't have it installed, but I suspect it would be something like:

 

uninstall-Package -name "Autodesk Civil 3D*"

 

That would likely do it.  I just tried it on a different program for me and it seemed to uninstall without any issues.  



Travis Nave Send TravisNave a Private Message                                             Need help in your post? Mention me with @TravisNave



My Expert Contributions to the
Autodesk Forums:
FLEXnet License Admin | MSI Cleanup Utility | .NET Framework Cleanup Tool | IPv6 NLM Fix | adskflex.opt Options File | Combine .LIC Files
0 Likes
Message 3 of 4

c-smoll
Explorer
Explorer

Thanks for the idea @TravisNave. I wasn't able to convince it to take a wildcard, but that's a minor thing to me. I ran Uninstall-Package against Storm and Sanitary 2024 using the -force and -whatif parameters. It gave me a progress bar and behaved as I'd expect it to. So, I ran it again minus -whatif. This time no progress bar and it returned to the console prompt almost immediately. No system changes were made. I tried it again against Storm and Sanitary 2023. But as with 2024, no actual changes were made. 

0 Likes
Message 4 of 4

c-smoll
Explorer
Explorer

The best result I was able to obtain came when I stopped the Autodesk licensing service before anything else. After doing this, Uninstall-Package gave me a sort of better result. But it was far from a complete uninstall.  

0 Likes