I am trying to automate a recurring task using a powershell script.
As per of the requirement, I have the below two situations.
1) Register a dll. DLL file exists locally. Regsrv32 is the only option available. But I am not sure if regsrv32 with /s switch (silent) will be the right option. Or is there any PowerShell alternate? Also, Once registered, Is there a way for me to check if the dll was registered successfully?
2) Execute an exe. This is basically for fixing something with the SCCM site code. ccmsetup.exe is located on the local directory and I am able to execute the entire command locally, which will fix. But thats not working if I am trying to use it remotely along with invoke-command.
Appreciate any help or guidance on this.
As far as checking for registration, you can use https://www.nirsoft.net/utils/registered_dll_view.html to easily find the associated class registry entry - and then check for that as part of your script.
Here is an example script that looks for the name instead of checking for the exact CSLID (which the above would give you - and be more efficient) - https://powershelladministrator.com/2019/12/17/register-dll-or-ocx-files-check-result/
2) I'd love to know what you have done to need to do this.
Anyway, make your life simple and use psexec within a for loop (batch vbs or powershell - whichever language you prefer) to target all the affected systems... or, since its the SCCM client, you could just re-push the client with the correct parameters (or use a start up script)
The only scenario i can think of where you would ever need to do anything manually to a site code is in a hierarchy migration that was not done well.