Solved

VBScript, Error 3 - Insufficient Privilege, Win32_Process.Create

Posted on 2008-10-08
7
1,691 Views
Last Modified: 2011-10-03
I'm trying to execute a VBscript program which creates a folder on remote computer and then copies few files from the local computer to the remote computer, I'm using WMI Win32_Process.Create method to create the folder. The script executes fine on certain computers but fails on certain others with the Error Code: 3 and the description given on the MSDN site states as 'Insufficient Privilege'

I have a domain account which has Local administration rights on all the machines, so the privilege issue doesn't make sense to me.

We have a mixed environment of Windows XP and Windows 2000 Professional computers. The script executes fine on both the OS, so I guess it is nothing to do with OS architecture.

I have been trying to find a good solution to this problem but not successful. I have tried all sorts of things suggested like disabling firewall, firewall services, re-starting WMI service, enabling Remote administration etc. on few remote machines but still without success.

The aim of my actual script is to execute a Batch program which removes all corrupted installation of AV's on the remote computers and thats the reason I'm copying certain files needed for the uninstallation.

Any help would be much appreciated and also please suggest me any other means with which we could create folders on remote computers. The ai

Attached is the piece of code I'm trying to execute:

strComputer = "USDT923077"
 

   Set objFSO = CreateObject("Scripting.FileSystemObject")

	

   Set objWMIService = GetObject("winmgmts:" & _

		"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")
 

   errReturn = objWMIService.Create("cmd.exe /c md C:\WINNT\Temp\AvTmp", Null, Null, intProcessID)
 
 

   If errReturn <> 0 Then
 

	Wscript.Echo "Cannot create Tmp directory on: " & strComputer & " Error Code: " & errReturn
 

	Wscript.quit

		

   Else

			

        Wscript.sleep 5000
 

        objFSO.CopyFile "C:\AV_Removal_Tool\Removal_Tools\*.*", "\\" & strComputer & "\C$\WINNT\Temp\AvTmp", OverwriteExisting
 

   End If

Open in new window

0
Comment
Question by:Freshandeasy
  • 4
  • 3
7 Comments
 
LVL 8

Expert Comment

by:rweil
Comment Utility
are "Command Extensions" enabled on the failing machines??

from  help md

Creates a directory.

MKDIR [drive:]path
MD [drive:]path

If Command Extensions are enabled MKDIR changes as follows:

MKDIR creates any intermediate directories in the path, if needed.
For example, assume \a does not exist then:

    mkdir \a\b\c\d

is the same as:

    mkdir \a
    chdir \a
    mkdir b
    chdir b
    mkdir c
    chdir c
    mkdir d

which is what you would have to type if extensions were disabled.

C:\>



0
 

Author Comment

by:Freshandeasy
Comment Utility
Stil I get the return error code as 3..Directory is not created
0
 
LVL 8

Expert Comment

by:rweil
Comment Utility
are "Command Extensions" enabled on the failing machines??

Freshandeasy said: Still I get the return error code as 3..Directory is not created

what did you try?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Freshandeasy
Comment Utility
Command extensions are enabled on the remote machine.
I also tried using MKDIR command instead of the MD..still it fails...
0
 
LVL 8

Accepted Solution

by:
rweil earned 500 total points
Comment Utility
Have you tried creating a different directory like c:\temp\AVtmp or c:\AVtmp?

Did you check permissions on the destination folders to verify that the domain account which has Local administration rights can create folders in that folders?

Can you go to the failing machine, log in with the  domain account which has Local administration rights and create folders?

just some thoughts on things to try. I am grasping at straws.
0
 

Author Comment

by:Freshandeasy
Comment Utility
Yes rweil, I have tried with different directories and ended up with the same result. Eventhough I have administrative access on the machines, I tried by manually adding myself to the Local administrators groups..still no luck..

I can create and modify the directories on the remote machine by logging in directly...like i said earlier this scripts runs fine on 50% of the machines, but fails on the rest. This is baffling and I cannot understand atleast the reason why it fails :(
0
 

Author Closing Comment

by:Freshandeasy
Comment Utility
close
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

6 Experts available now in Live!

Get 1:1 Help Now