Solved

Error running WMIC against computers on network

Posted on 2008-10-23
3
3,554 Views
Last Modified: 2009-02-20
I am stumped with the issue here. I am running a script that will change machines from Static IP addresses to DHCP. In the test environment everything works great, but when I expand my testing to a few live machines the script throws errors. The only thing that I can think is if there is a limitation of WMIC to only run on local subnet. There is no firewall between locations.

I attached the code from the batch file.

In the test environment, this is the result i get:

C:\>(
wmic /node:'m-is003' process call create 'cmd.exe /c "netsh interface ip set address name="Local Area Connection" source=dhcp"'
 echo 0
 wmic /node:'m-is003' process call create 'cmd /c "netsh interface ip set dns name="Local Area Connection" source=dhcp"'
 echo 0
 wmic /node:'m-is003' process call create 'cmd /c "netsh interface ip set wins name="Local Area Connection" source=dhcp"'
 echo 0
)
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ProcessId = 4116;
        ReturnValue = 0;
};

0
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ProcessId = 3936;
        ReturnValue = 0;
};

0
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ProcessId = 3824;
        ReturnValue = 0;
};

0


Here is what I get when I run it on live machines elsewhere:

C:\>(
wmic /node:'SCN92' process call create 'cmd.exe /c "netsh interface ip set address name="Local Area Connection" source=dhcp"'
 echo 0
 wmic /node:'SCN92' process call create 'cmd /c "netsh interface ip set dns name="Local Area Connection" source=dhcp"'
 echo 0
 wmic /node:'SCN92' process call create 'cmd /c "netsh interface ip set wins name="Local Area Connection" source=dhcp"'
 echo 0
)
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 8;
};

0
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 8;
};

0
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 8;
};

0


If anyone has any ideas why this won't work because I am stumped and I haven't been able to find out what the returnvalue = 8 means. There are no logs in the eventviewer and all is the same on the workstations.

thanks,






FOR /F "tokens=1" %%A IN (C:\temp\test.txt) DO (
 

wmic /node:'%%A' process call create 'cmd.exe /c "netsh interface ip set address name="Local Area Connection" source=dhcp"'

echo %errorlevel%

wmic /node:'%%A' process call create 'cmd /c "netsh interface ip set dns name="Local Area Connection" source=dhcp"'

echo %errorlevel%

wmic /node:'%%A' process call create 'cmd /c "netsh interface ip set wins name="Local Area Connection" source=dhcp"'

echo %errorlevel%

)

Open in new window

0
Comment
Question by:PVHS
3 Comments
 
LVL 10

Expert Comment

by:kyleb84
Comment Utility

(0x00000008) ERROR_OUTOFMEMORY = 8

I doubt that this is really the case, it's probably a WMIC custom error...


In any case, are you running this script on a server, then referencing the targets by their NETBIOS name?
Or are you running the script on each client?

If it's the former, I'd have a look at your permissions.
If it's the latter, try referencing the client by "localhost" instead of it's netbios name.

---------------------------

I've just ran that script on my laptop with the node "localhost", no error.
With the node "tuskes", no error. TUSKES is another laptop on my network.


Make sure you've got all the pre-req's installed on the client computers.

0
 
LVL 7

Expert Comment

by:maze-uk
Comment Utility
Maybe you could disable the ICS service first:

SC %%A Stop "Windows Firewall/Internet Connection Sharing"
Wmic...
wmic...
SC %%A Start "Windows Firewall/Internet Connection Sharing"

Also have a look here: http://msdn.microsoft.com/en-us/library/aa389290(VS.85).aspx
"WMI can be used to manage and access WMI data on remote computers. Remote connections in WMI are affected by the Windows Firewall and DCOM settings. In Windows Vista and later operating systems, User Account Control (UAC) may also require changes to some settings. For more information, see Connecting to WMI Remotely Starting with Vista."

0
 

Accepted Solution

by:
PVHS earned 0 total points
Comment Utility
I am running this script from a central server to remote machines using netbios names. I have to update over 200 machines, using a text file list. I am running this with Domain Admin credentials so I don't know if permissions would be an issue. But it is not unheard of. What permissions should I verify?

Also stopping the Firewall service made no change, because we already have the firewall turned off by default.



0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Know what services you can and cannot, should and should not combine on your server.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now