USING POWERSHELL FOR REMOTE COMPUTERS
$Computername = 'Computer01.domain.com'
$Command = {
(Get-Service tmlisten).WaitForStatus('Stopped','00:05:00')
Stop-service winmgmt -Force
(Get-Service winmgmt).WaitForStatus('Stopped','00:05:00')
$sysroot = $env:SystemRoot
Rename-Item 'c:\windows\system32\wbem\repository' 'c:\windows\system32\wbem\repository.old'
#rd -recurse -force repository
regsvr32 /s $sysroot\system32\scecli.dll
regsvr32 /s $sysroot\system32\userenv.dll
gci -filter *.dll | % {regsvr32 /s $_.Name}
gci | where {'.mof', 'mfl' -contains $_.Extension}| % {mofcomp $_.Name}
mofcomp -n:root\cimv2\applications\exchange wbemcons.mof
mofcomp -n:root\cimv2\applications\exchange smtpcons.mof
}
$s = New-PSSession -ComputerName $Computername -Authentication Kerberos -UseSSL
Invoke-Command -Session $s -ScriptBlock $command
**********************************************************************
MANUAL WMI REPAIR
- Stop WMI Service
- Go to %windir%\System32\wbem
- Rename the folder called "Repository" to "Repository.bak"
- Open an Admin CMD
- CD to %windir%\System32\wbem
- Run the following command:
for /f %s in ('dir /b /s *.dll') do regsvr32 /s %s - CD to C:\ (root directory)
- Run the following command:
for /f %s in ('dir /s /b *.mof *.mfl') do mofcomp %s - Reboot the PC (optional)
No comments:
Post a Comment