Solved

Error running WMIC against computers on network

Posted on 2008-10-23
3
3,579 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
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Is your computer hacked? learn how to detect and delete malware in your PC
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

914 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

21 Experts available now in Live!

Get 1:1 Help Now