Jump to content

Permissions issues with FileExists

Recommended Posts

I'm creating a script that will be run by users with Administrator privileges:

RunAsSet("Administrator", "DOMAIN", "password")
If FileExists("C:\WINDOWS\$NtUninstallKB917013$\spuninst\spuninst.exe") Then
Run("C:\WINDOWS\$NtUninstallKB917013$\spuninst\spuninst.exe /q /norestart")

I only want it to trigger if the package is actually on the computer, hence the If FileExists. however, the file that I need to use for determining whether or not the package is installed (spuninst.exe) is in a location that a user without Administrator privileges does not have access to. Therefore, the If FileExists assertion fails, because (I assume) the If FileExists is being executed with the user's default privileges and not the escalated privileges used by RunAsSet.

So my question is, is there a way to perform the If FileExists check with escalated (e.g. Administrator-level) privileges?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...