locked
Problem with a VBScript RRS feed

  • Question

  • I'm using a WSC VBScript to install several applications on 70 Vista laptop computers.  I know that some of these require elevation, so I put the following lines into the start of the script:

     

     ' Make sure the script runs as administrator...
     If WScript.Arguments.length = 0 Then
       Set objShell = CreateObject("Shell.Application")
       'Pass a bogus argument with leading blank space
       objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " UAC_PROMPT", "", "runas", 1
       WScript.Quit 
    end If

    This works extremely well... on most of the computers.  On just a few computers, later on in the script where I need to delete some files in a Program Files subfolder, I get an "Access Denied" error.  The user is an Administrator, and UAC is turned on.  I tried running the script from a command prompt, started as "Run as administrator," and the same thing happend.

     

    Any clues as to why this is happening, and what I can do about it?

     

    TIA!!

     

    Martin

    Wednesday, October 15, 2008 5:51 PM

Answers

  • Hi,

    What files are you trying to delete? Have you tried taking ownership (takeown /? or takeown /f folder) of the sub-folder first? That usually does the trick.
    Wednesday, October 15, 2008 6:23 PM

All replies

  • Hi,

    What files are you trying to delete? Have you tried taking ownership (takeown /? or takeown /f folder) of the sub-folder first? That usually does the trick.
    Wednesday, October 15, 2008 6:23 PM
  • Thanks for the response!

     

    I'm trying to delete all of the files in the folder, including the executables.

     

    I had never heard of "takeown".  I'll give it a try.  Thanks!

     

    Martin

    Wednesday, October 15, 2008 8:23 PM