Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Trying to un-register and then re-register an OCX file.

$
0
0

Hi All,

As in the title, I'm trying to un-register and then re-register an OCX file using powershell.

This needs to be done on a remote machine.

So far I have:

 

# declare the local target path variable

$LF_Path = "C:\Windows\SysWow64\MSCOMCTL.OCX"

$Machine = SomeMachineOutThere

 

# un-register the ocx file from the machine

Write-Host " Unregistering MSCOMCTL.OCX..."

Invoke-Command -ComputerName $Machine -ScriptBlock { & 'regsvr32 /u' $args[0] } -ArgumentList $LF_Path

 

# re-register the ocx file from the machine

Write-Host " Reregistering MSCOMCTL.OCX..."

Invoke-Command -ComputerName $Machine -ScriptBlock { & 'regsvr32' $args[0] } -ArgumentList $LF_Path

 

The issue I'm faced with, is that un-registering yields the error:

 

The term 'regsvr32 /u' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
    + CategoryInfo          : ObjectNotFound: (regsvr32 /u:String) [], Command
   NotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
I can find a great number of examples online for registering, but only one on unregistering. The one for unregistering is using cmd which I'd like to avoid if possible.
Can anyone help?

Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images