Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell remotely register COM dll by using regsvr32

I found on Internet, this ps script may work. But the result I get is: no error pops up, but also DLL not found in registry after running the script.

Invoke-Command -ComputerName $servername -ScriptBlock {regsvr32.exe "\\uncpath\some.dll" }

I tried in both "run as administrator" and normal PS console window, and windows remote management service is on on remote server.

Any idea?

like image 577
Samuel Avatar asked Dec 05 '25 14:12

Samuel


1 Answers

You need to use the silent option of regsrv32 (/s):

Syntax REGSVR32 [/U] [/S] [/N] /I:[CommandLine] DLL_Name

Key /u Unregister Server.

/s Silent, do not display dialogue boxes.

/i Call DllInstall to register the DLL. (when used with /u, it calls dll uninstall.)

/n Do not call DllRegisterServer, you must use this option with /i.

CommandLine An optional command line for DllInstall

/c Console output (old versions only).

like image 159
Loïc MICHEL Avatar answered Dec 08 '25 15:12

Loïc MICHEL