Solved

VBScript, Error 3 - Insufficient Privilege, Win32_Process.Create

Posted on 2008-10-08
7
1,710 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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