4

I have about 100 dll's I need to register with regsvr32 /s some.dll, do I need to wait for each call to regsvr32 to finish before I do the next call or can I just run them all at the same time.

Basically I have the Powershell script

if([System.Environment]::Is64BitOperatingSystem)
{
    $regsvr = [System.Environment]::ExpandEnvironmentVariables('%windir%\SysWOW64\regsvr32.exe')
}
else
{
    $regsvr = [System.Environment]::ExpandEnvironmentVariables('%windir%\System32\regsvr32.exe')
}

foreach( $file in $filesToRegister)
{   
    Write-Verbose "$regsvr /s ""$file"""
    Start-Process $regsvr -ArgumentList '/s', """$file""" -Wait
}

All of the files that are being registered are vb6 dll files that are generated by a large project. Do i need to have the -Wait on my Start-Process or is it safe to take it off?

1 Answers1

4

After playing around a bit I discovered that regsvr32 lets you pass in more than one file at a time. Switching $filesToRegister to use relative paths to get the total length of the argument list down and I now do

if([System.Environment]::Is64BitOperatingSystem)
{
    $regsvr = [System.Environment]::ExpandEnvironmentVariables('%windir%\SysWOW64\regsvr32.exe')
}
else
{
    $regsvr = [System.Environment]::ExpandEnvironmentVariables('%windir%\System32\regsvr32.exe')
}

Set-Location $currentBuildFolder
$arguments = @('/s') + $filesToRegister
Write-Verbose "$regsvr $arguments"
Start-Process $regsvr -ArgumentList $arguments -Wait

And it completes much much faster.