its setting
WBEM_FLAG_CONNECT_USE_MAX_WAIT
No timeout :
Set objWMIService =
objSWbemLocator.ConnectServer(strComputer,"root\CIMV2","","","","",&H0 )
2 minute timeout
Set objWMIService =
objSWbemLocator.ConnectServer(strComputer,"root\CIMV2","","","","",&H80 )
(only 2 options)
you can not do this with a moniker, I think
I did find a way to do a more ganular control in MSH but it uses .NET
MSH > $scope = new-object system.management.managementscope
MSH > $p = new-object system.management.managementpath
MSH > $p.server = "fake"
MSH > $p.NamespacePath = "root\cimv2"
MSH > $scope.set_path($p)
MSH > $t = new-object System.TimeSpan(0, 0, 5)
MSH > $t.duration()
MSH > $ogo.timeout = $t
MSH > $ogo
MSH C:\MowMSH> $scope.connect()
UseAmendedQualifiers Context Timeout
-------------------- ------- -------
True {} 00:00:05
MSH H:\> $scope.set_Options($ogo)
scope.connect()
greetings /\/\o\/\/
PS could not realy test tis I don't have the problem when using a fake adress
=================================================================
"/\/\o\/\/" <o...@discussions.microsoft.com> wrote in message
news:570389A8-9CBF-4384...@microsoft.com...
> try this
>
> its setting
> WBEM_FLAG_CONNECT_USE_MAX_WAIT
>
> No timeout :
>
> Set objWMIService =
> objSWbemLocator.ConnectServer(strComputer,"root\CIMV2","","","","",&H0 )
>
> 2 minute timeout
>
> Set objWMIService =
> objSWbemLocator.ConnectServer(strComputer,"root\CIMV2","","","","", &H80 )
We use this with WMI and other scripts we use to collect info from our
workstations and/or to make scripted configuration changes. Basically you
trap the output of a "net view" command, and then have your script skip any
computers that do not appear in that list.
The main reason our systems are not in the browse list or not otherwise
accessible is because the users have turned them off. If we absolutely need
to update or query all, we just keep a list of which have been touched, and
periodically re-run the script that tries to touch them all.
The master browser does not update itself instantaneously, so that creates
some latency with the following ramifications:
1) a system could have just been powered ON and ready for our script to run,
but not be touched because it is not yet listed in the browser.
2) a system could have just been powered OFF. Our script then wastes timeout
time waiting for a system that will nto respond.
Since our main purpose is to keep the runtime of our scripts reasonable,
this is a good tradeoff. The best time to run our scripts is therefore
between 8:30 and 11:00, as most machines that will be on in the day will be
on then. Quitting time is the worst time for the opposite reason.
If your connectivity issues are more GPO based, you might find that systems
are browsable, but not accessible to your purposes. In that case you may
have little to gain from this method.
/Al
"Toan Do" <toa...@cybersoft-vn.com> wrote in message
news:ud6URzyy...@tk2msftngp13.phx.gbl...
>
> If your connectivity issues are more GPO based, you might find that systems
> are browsable, but not accessible to your purposes. In that case you may
> have little to gain from this method.
>
computers, that ARE off don't usualy give problems,
computers that ARE on but have problems, in this case the firewall,
but also it happens (to mutch)that WMI is corrupt,
correct this like this :
Stop the WMI service.
Delete the WMI repository directory.
Restart the WMI service. The WMI repository is reinstalled shortly after
see also
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/reinstalling_wmi.asp
to quicken things further you can start more checks in parralel.
gr /\/\o\/\/
to process more than 1 at the same time, so that a few "bad Apples" do
not keep you up to mutch.
you can use following script(s).
1 calling and 1 script(go.cmd) to put your code in.
you can set MaxProcess and Delay to finetune the process
gr /\/\o\/\/
________________________________
Main Script
________________________________
@Echo off
echo 0 > count.txt
set maxProcess=5
set Delay=5
:start
for /f %%i in (count.txt) do set count=%%i
if %count% LSS %maxProcess% call :go
echo %count% processes Running
ping -n %Delay% 127.0.0.1 > nul
goto :start
:EOF
:go
start /b go.cmd
echo New Process started
set /a count=%count%+1
echo %count% > count.txt
:EOF
______________________________
Go.cmd
______________________________
@echo off
::::::::::::
:: Code Here
::::::::::::
cscript //nologo sleep.vbs
::::::::::::::::::
:: Sync management
::::::::::::::::::
for /f %%i in (count.txt) do set count=%%i
set /a count=%count%-1
echo %count% > count.txt
echo Process Ended
exit
I guess we are just lucky then, as we our workstations are all on the same
side of the firewall, and we do not seem to have WMI corruption problems.
Still, we do save some wasted time by this method - just not as much as the
OP wastes because of the problems he has and we don't.
> correct this like this :
>
> Stop the WMI service.
> Delete the WMI repository directory.
> Restart the WMI service. The WMI repository is reinstalled shortly after
>
> see also
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/reinstalling_wmi.asp
>
> to quicken things further you can start more checks in parralel.
That sounds like a very useful approach if one expects to have some
computers taking minutes to fail out from a WMI call...
/Al