Home > SCCM 2007 / 2012 > SCCM 2007: Run programs as administrator without local admin priviliges

SCCM 2007: Run programs as administrator without local admin priviliges

In some circumstances it may be useful to run a specific program as administrator without granting the user admin rights, especially old applications that require to run as administrator. I found that this is possible via SCCM by creating a shortcut with a VBS script behind to run a program with Administrative privileges. You can also use Run Advertised programs but this not very user friendly. It’s not very recommended because the application cannot run when the SCCM server is not available but it’s sometimes very useful!

My code below can be used when you change the two variables below:

ProgramID = Name of the progams in the package
PackageID = The ID of the package

Make sure that the program is advertised to the client. You can get the package id easily with the Client Center Tool of Roger Zander by showing the published advertisements:

Client center Tool for Configuration manager 2007: http://sourceforge.net/projects/smsclictr/ 

'Run the program with Local System account)

Option Explicit

Call RunProgram("RunAS", "STC00030")

Sub RunProgram(programId, packageId)

Dim oUIResource
 Dim oPrograms
 Dim oProgram

Set oUIResource = CreateObject ("UIResource.UIResourceMgr")

If oUIResource Is Nothing Then
 wscript.echo "Could not create Resource Object - quitting"
 Exit Sub
 End If

if oUIResource.IsMandatoryProgramPending = 1 Then
 Wscript.Echo "Mandatory program pending. Try again later."
 Set oUIResource = Nothing
 Exit Sub
 End If

Set oProgram = oUIResource.GetProgram(programId, packageId)
 'WScript.Echo "oProgram: " & oProgram.Name
 if oProgram is Nothing Then
 WScript.Echo "Couldn't get the program"
 Set oUIResource = Nothing
 Exit Sub
 End If

'Wscript.Echo "Running program: " & oProgram.FullName

oUIResource.ExecuteProgram programId, packageID, True

Set oProgram = Nothing
Set oUIResource = Nothing

End Sub

Code based on: http://msdn.microsoft.com/en-us/library/cc143667.aspx


Categories: SCCM 2007 / 2012
  1. May 18, 2013 at 9:23 am

    Your style is very unique compared to other folks I have read stuff
    from. Many thanks for posting when you’ve got the opportunity, Guess I’ll just book mark this blog.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: