Re: The system cannot find the file specified - Win32_NetworkAdapt



Hi,
I think I've found the problem - Kaperksy A/V had REMOVED the wmiprvse.exe
as a trojan per below. I restored the file and problem solved !!!!!
Looking into whether this was a 'false positive'.........

deleted: Trojan program Backdoor.Win32.Agent.afqs File:
C:\WINDOWS\system32\wbem\wmiprvse.exe

Regards
Michael Green



"Richard Mueller [MVP]" wrote:

The script works fine for me, once I added "Dim intCtr". Is the OS Vista?
The only update I've seen recently (5/7) is IE 8 for Vista.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"RIMikeG" <RIMikeG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E4DD917E-272F-43F4-BD38-F3E0532F52B6@xxxxxxxxxxxxxxxx
Alex,
The script is running stand-alone - although you are correct that it was
extracted from the larger script which is also failing.

I'm not sure why the 'Option Explicit' wasn't catching the fact that
intCtr
was not defined - but it wasn't getting to that code anyway.

There is no loading of external script files.

I've confirmed this error is generated the moment variable IPConfigSet is
accessed.

All this was working fine.......





"Alex K. Angelopoulos" wrote:

This isn't exactly how you're running it, I don't believe. I say that
because the code you pasted doesn't dim intCtr, which means the script
would
fail in real use if it were a monolithic script file.

With that taken care of, it works fine for me. I suspect that the error
you're getting is actually pointing at a real problem somewhere in the
code
as you really run it. Are you loading an external file that contains the
script functions, or something?


"RIMikeG" <RIMikeG@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FCEAE384-6419-4334-A732-32DF90E965C8@xxxxxxxxxxxxxxxx
Hi,
I've been using a Microsoft piece of script to obtain the first IP
address
of a computer for use in the logon script. This was working fine until
some
Microsoft Critical Updates applied on Friday.

Now its returning a message :

The system cannot find the file specified

on line :
For Each IPConfig in IPConfigSet

When it tries to enumerate the Ip addressess.

Has anyone had a similar problem ?

Script is below:



option explicit

Dim m_WshNetwork
Dim m_objWMIService
Dim strComputer

strComputer = "."
Set m_objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer
&
"\root\cimv2")

wscript.echo getFirstIPAddress()


Function getFirstIPAddress

'http://www.microsoft.com/technet/scriptcenter/scripts/network/client/list/nwlsvb01.mspx
Dim IPConfigSet
Dim IPConfig

Set IPConfigSet = m_objWMIService.ExecQuery("Select * from
Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For intCtr = LBound(IPConfig.IPAddress) to
UBound(IPConfig.IPAddress)
wscript.echo IPConfig.IPAddress(intCtr)
Next
End If
Next

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For intCtr = LBound(IPConfig.IPAddress) to
UBound(IPConfig.IPAddress)
if (IPConfig.IPAddress(intCtr) <> "0.0.0.0") then
getFirstIPAddress = IPConfig.IPAddress(intCtr)

exit function
End If
Next
End If
Next

End Function





.



Relevant Pages