I have a powershell script that copies a .dll to C:\Windows\System32 and I am trying to also, in the script, register the .dll. It successfully registers if the path of the .dll is the source folder (C:\Temp) but the .dll doesn’t register when residing in C:\Windows\System32. The script is being run as administrator so permissions are not the issue. I confirmed the registration/non-registration by searching HKCR\Typelib.
Here is my current code:
$Location = Get-Location
$system32 = $env:SystemRoot\system32
Copy-Item -Path "$Location\msvbvm50.dll" -Destination $system32
Set-Location $env:SystemRoot\system32
Start-Process regsvr32.exe "/s msvbvm50.dll"
Can someone, please, provide some tips on how to properly register .DLLs in the system32 folder using a script?