Solved

VBScript To RunAs USER - GPUPDATE

Posted on 2009-05-08
1
1,283 Views
Last Modified: 2012-06-27
Hi,

I am looking for a VBScript to runas another user (local admin) to start gpupdate/force as this specific user. I have not been able to find the code to do this. Script needs to be configurable with user/password.

Thanks,
Ryan
0
Comment
Question by:Ryan Rood
1 Comment
 
LVL 1

Accepted Solution

by:
Ryan Rood earned 0 total points
ID: 24338559
Found a solution.
Set WshShell=WScript.CreateObject("WScript.Shell")
strCmd="C:\windows\system32\gpupdate.bat"
strUser="DOMAIN\USER"
strPass="PASSWORD"
set WshShell=CreateObject("WScript.Shell")
WshShell.Run "runas.exe" & " /u:" & strUser & " " & strCmd
WScript.Sleep 1000
WshShell.Sendkeys strPass & "~"

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 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