Solved

Error running WMIC against computers on network

Posted on 2008-10-23
3
3,692 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Expert Comment

by:kyleb84
ID: 22791631

(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
ID: 22795459
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
ID: 22824014
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

695 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