digital8 Second Lieutenant
Joined: 29 Sep 2005
Posts: 1002
|
Posted: Fri Oct 07, 2005 12:03 pm Post subject: Rebuilding WMI |
|
|
OK, so you have upgraded your clients to SMS 2003 from 2.0. But you still have a number of clients that you cannot ignore and that will not install the upgrade. We have had this problem, and I have seen approximately 100 machines that would not upgrade to
2003.
After doing some preliminary research, I found that SMS 2003 could not connect to the client WMI. I used the WMI MMC snap-in and found that I also could not connect. I checked permissions on the local machine, and all signs pointed to rebuilding WMI. This is not a big problem if you are working on a single machine, because you can simply stop the WINMGMT service, delete the %SYSTEM32%\wbem\Repository folder, and restart WINMGMT.
The only solution that proved viable was to create a package and deploy it via PSExec.exe, as these machines were assigned but not installed (more on this later). The SMS Installer script is denoted below.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
item: Set Variable
Variable=ROOT0
Value=c:\WINDOWS\system32
end
item: Check Disk Space
Component=COMPONENTS
end
item: Start/Stop Service
Service Name=CcmExec
Flags=00000001
end
item: Sleep
Sleep=3000
end
item: Start/Stop Service
Service Name=winmgmt
Flags=00000001
end
item: Sleep
Sleep=2000
end
item: Delete File
Pathname=%ROOT0%\Wbem\Repository\*
Flags=00001100
end
item: Sleep
Sleep=300
end
item: Start/Stop Service
Service Name=winmgmt
end
item: Start/Stop Service
Service Name=CcmExec
end
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The reason CcmExec is in there it’s because I had a number of clients that were installed but WMI was still having problems. As a precautionary measure I added in the stop of the CcmExec service before stopping Winmgmt as WMI will not stop if CcmExec is still running. After these services are stopped I delete the Repository and restart the services.
Running this package on clients requires the tool PSexec.exe which is downloadable for free from the following site http://www.sysinternals.com/files/psexec.zip. Unless you want to copy it into the directory from which you run the batch file, I suggest you just copy it to your System32 directory. When you are ready to run the package on the computers you have identified, just add all of the computer names into a txt file
(we will use WMI.txt), create a batch file called RP.bat, and create two more txt files called Success and Failure. Move these files to a folder of your choice. For this example we will use WMI. When this is complete, edit RP.bat, and add the following:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@Echo Off
if “%1”==”GoTo” goto %2
for /F “tokens=*” %%A in (WMI.txt) do call %0 GoTo process %%A
goto eof
:process
if “%3”==”” goto eof
PSEXEC \\%3 -u domain\username -p password “\\server\WMI rebuild.EXE”
if errorlevel 0 Echo %3 >> “C:\WMI\SUCCESS.TXT”
if not errorlevel 0 Echo %3 >> “C:\WMI\FAILURE.TXT”
shift
goto process
:eof
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If you are not familiar with PSExec, there are a few points to which you should take notice.
1. The “-u Domain\username -p password” is not necessary if you are running this as an Administrator to the box.
2. The Quotes around \\server\WMI rebuild.EXE are not needed unless there are spaces in the path of the package you created. |
|