Solved

Error running WMIC against computers on network

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

776 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