Files

42 lines
1.6 KiB
PowerShell
Raw Permalink Normal View History

2023-10-05 13:11:38 -04:00
Write-Output "Fix-WindowsScriptingComponents.ps1"
2020-10-22 14:01:35 -04:00
## List of all scripting component DLL files
2020-08-18 16:20:20 -04:00
$DLL_FILES = @("${Env:WINDIR}\system32\vbscript.dll",
"${Env:WINDIR}\system32\jscript.dll",
"${Env:WINDIR}\system32\dispex.dll",
"${Env:WINDIR}\system32\scrobj.dll",
"${Env:WINDIR}\system32\scrrun.dll",
"${Env:WINDIR}\system32\wshext.dll"
"${Env:WINDIR}\system32\wshom.ocx",
"${Env:WINDIR}\syswow64\vbscript.dll",
"${Env:WINDIR}\syswow64\jscript.dll",
"${Env:WINDIR}\syswow64\dispex.dll",
"${Env:WINDIR}\syswow64\scrobj.dll",
"${Env:WINDIR}\syswow64\scrrun.dll",
"${Env:WINDIR}\syswow64\wshext.dll",
"${Env:WINDIR}\syswow64\wshom.ocx")
## Unregister all DLLs
ForEach ($dll in $DLL_FILES)
{
If ( Test-Path $dll )
{
If ( $dll -Match "syswow64" ) { $REGSVR32 = "${Env:WINDIR}\syswow64\regsvr32" } Else { $REGSVR32 = "regsvr32" }
2023-10-05 13:11:38 -04:00
Write-Output "Unregister: ${dll}"
2020-10-22 14:01:35 -04:00
Try { Start-Process "${REGSVR32}" -ArgumentList "/u /s ${dll}" -Wait }
2023-10-05 13:17:18 -04:00
Catch { Write-Error $_.Exception.Message }
2020-08-18 16:20:20 -04:00
}
}
## Register all DLLs
ForEach ($dll in $DLL_FILES)
{
If ( Test-Path $dll )
{
If ( $dll -Match "syswow64" )
{ $REGSVR32 = "${Env:WINDIR}\syswow64\regsvr32" } Else { $REGSVR32 = "regsvr32" }
2023-10-05 13:11:38 -04:00
Write-Output "Register: ${dll}"
2020-10-22 14:01:35 -04:00
Try { Start-Process "${REGSVR32}" -ArgumentList "/s ${dll}" -Wait }
2023-10-05 13:17:18 -04:00
Catch { Write-Error $_.Exception.Message }
2020-08-18 16:20:20 -04:00
}
}