Sahus

Here is the code I am using:

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

strIPAddress = Array("192.168.0.1")

strSubnetMask = Array("255.255.255.0")

For Each objNetAdapter in colNetAdapters

WScript.Echo objNetAdapter.Caption

If Left (objNetAdapter.Description, 15) = "Realtek RTL8150" Then

errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)

If errEnable = 0 Then

WScript.Echo "The IP address has been changed."

Else

WScript.Echo "The IP address could not be changed. Error = 0x" & Hex(errEnable)

End If

End If

Next

The same code works fine on XP, but on Vista (build 5472) I get this error 0x80070005 which is related to not having enough priviledge. I am already logged in as Administrator, why it is having problem with priviledge/permissions.

If anyone has any solutions to this, please let me know.

Thanks,

Sahus.



Re: Windows SDK WMI Win32_NetworkAdapterConfiguration EnableStatic call fails with error 0x80070005

wlf

I have this same problem but in Vista 5536 and i can get it run

I try to configure my ip address and no change






Re: Windows SDK WMI Win32_NetworkAdapterConfiguration EnableStatic call fails with error 0x80070005

jitbit

I have the same problem on Vista 6.0.6000 - it is the final build released on november, and the problem is still there.

"EnableStatic" returns 80041003 error (not enough permissions) and IP-address does not change. Tested under administrator account.

Under WinXP SP2, and under Win2000 same script works just fine.





Re: Windows SDK WMI Win32_NetworkAdapterConfiguration EnableStatic call fails with error 0x80070005

jitbit

After some research I have found out that

80041003 is WBEM_E_ACCESS_DENIED wmi error number which means "The current user does not have permission to perform the action".

But the user is adminitrator. Moreover - I have launched "wmimgmt.msc" (WMI management console) to ensure that the current user account has full permissions to the wmi namespace - it does!

EnableStatic method (or any other method of win32_NetworkAdapterConfiguration class) throws this error when launched both from script or from a compiled exe-program (yes, I wrote a simple program in VB, which calls to WMI using COM).

I believe that is a bug in Vista. :-( Any other ideas





Re: Windows SDK WMI Win32_NetworkAdapterConfiguration EnableStatic call fails with error 0x80070005

Alex 312

Any ideas, anyone

WMI is simply not working under Vista :(





Re: Windows SDK WMI Win32_NetworkAdapterConfiguration EnableStatic call fails with error 0x80070005

MVP User

After some research I have found out that

80041003 is WBEM_E_ACCESS_DENIED wmi error number which means "The current user does not have permission to perform the action".

But the user is adminitrator. Moreover - I have launched "wmimgmt.msc" (WMI management console) to ensure that the current user account has full permissions to the wmi namespace - it does!

EnableStatic method (or any other method of win32_NetworkAdapterConfiguration class) throws this error when launched both from script or from a compiled exe-program (yes, I wrote a simple program in VB, which calls to WMI using COM).

I believe that is a bug in Vista. :-( Any other ideas


Works for me, are you sure you run as Administrator
Try to run wbemetest.exe from a command box that has been started with  "Run As administrator".
Connect to the cimv2 namespace and click "Execute method..", enter the win32_NetworkAdapterConfiguration.Index=n as object path, where n is the index of the network for which you want to enable Static IP, edit the input arg. and execute the command.
 
Willy.
 
 
 




Re: Windows SDK WMI Win32_NetworkAdapterConfiguration EnableStatic call fails with error 0x80070005

MVP User

Any ideas, anyone

WMI is simply not working under Vista :(


Sure it does.
 
Willy.