VBScript, Error 3 - Insufficient Privilege, Win32_Process.Create

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

FreshandeasyAsked:
Who is Participating?
 
Roy WeilConnect With a Mentor ownerCommented:
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
 
Roy WeilownerCommented:
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
 
FreshandeasyAuthor Commented:
Stil I get the return error code as 3..Directory is not created
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Roy WeilownerCommented:
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
 
FreshandeasyAuthor Commented:
Command extensions are enabled on the remote machine.
I also tried using MKDIR command instead of the MD..still it fails...
0
 
FreshandeasyAuthor Commented:
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
 
FreshandeasyAuthor Commented:
close
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.