Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WMI slows down boot process

Status
Not open for further replies.

mizzy

IS-IT--Management
Jun 28, 2001
277
0
0
AU
Hi everyone

We use AD here on Windows 2003 DC's totally patched.
All our workstations are XP totally patched.

I use a computer GPO (calling a startup script) to install antivirus software (if it is not already installed). I use the following vb script to do this

' * Set the current parameter with value of SCS Installation
Current_SCS = """{0698cecb-9072-47b1-aea1-94ca350989b8}"""

' * Find Out version installed to this computer

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product where IdentifyingNumber =" & Current_SCS ,,48)

' * If latest version of scsc installed then quit
For Each objItem in colItems

' * Correct version installed quit
wscript.quit

next

Otherwise continue and install Symantec AV
etc etc etc


When I disable this GPO (calling vbscript above) the boot up process speeds up dramatically (when enabled the boot up can take 5-10 minutes, when disabled 30 seconds. By boot up I mean the time it takes from powering on to the moment I see the Ctrl+Alt+Del screen)
Can someone tell me why the piece of code above is slowing things down. Maybe perhaps doing this in a GPO is daft, I'd appreciate if someone could advise.

Many many thanks
 
Normally when you boot up a PC, the Ctrl-Alt-Del screen appears before the operating system has finished loading all the services. Enough has been loaded to enable it to process a logon request but some elements that aren't required for logon may still be loading.

By adding a startup script that uses WMI, you may be causing the workstation to wait until the services necessary for WMI to function have loaded.

My company used RIS to build PCs and we added a similar script to install SAV as part of the build process, we also used MS SMS 2003 to roll out new versions, if you don't have options like these, you could try a marker file.

We used marker files for a few scripts, basically it's a file that you put in a specific location so that you can test for it's presence. So you get your script to test for the presence of a file, if it is there the script closes, if it isn't the script does whatever it does, then puts the file in the test location, indicating that the task has been done. The next time the script runs it will detect the file and close. Without having to load WMI or anything else.

OK it has the disadvantage that users could delete the file, or create it, but if you bury the test location deep, then this becomes less likely.


 
cheers BillDoor,

I have a batch file ready and waiting to do exactly what you say (we check for a symantec file).

Oh well....I've seen a few other posts about WMI functions slowing up....perhaps this is my problem here. WMI is just slow..(When I created this script over six months ago it worked a treat....now its slowing things up all over the place)

If any one else has a precise explanation I'd appreciate it.
 
[1] Usual factor to speed up the query is to restrict the attributes to return. Hence instead of *, just put a name, for instance.

Set colItems = objWMIService.ExecQuery("Select * from Win32_Product where IdentifyingNumber =" & Current_SCS ,,48)
[tt]Set colItems = objWMIService.ExecQuery("Select [blue]name[/blue] from Win32_Product where IdentifyingNumber =" & Current_SCS ,,48)[/tt]

But this won't radically speed up the checking.

[2] To radically speed up the checking, it is better to query instead the registry, hklm branch, for the product, for instance.
[tt]
'use displayname is just one option
sname="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\[blue]{0698cecb-9072-47b1-aea1-94ca350989b8}[/blue]\DisplayName"
set wshshell=createobject("wscript.shell")
on error resume next
sval=wshshell.regread(sname)
if err.number=0 then 'this assume the case value always set
'product installed on the machine
set wshshell=nothing
wscript.quit
end if
on error goto 0
'continue with installation part
[/tt]
In a startup script, the credential should be amply enough.
 
You beauty! that sounds like a plan. I'll advise how it goes. Many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top