Solved

VBScript, Error 3 - Insufficient Privilege, Win32_Process.Create

Posted on 2008-10-08
7
1,703 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
ID: 22669024
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
ID: 22676609
Stil I get the return error code as 3..Directory is not created
0
 
LVL 8

Expert Comment

by:rweil
ID: 22676672
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Freshandeasy
ID: 22677660
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
ID: 22677746
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
ID: 22678662
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
ID: 31504161
close
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 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

24 Experts available now in Live!

Get 1:1 Help Now