[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Run section of vbscript code with elevated privilages

Posted on 2006-04-12
3
Medium Priority
?
1,714 Views
Last Modified: 2010-05-18
Hi,
Hope this is in the right topic area, couldn't see one dedicated to vbscript.  I've been asked to add the following code to our logon script to disable microsoft firewall on all clients.

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile
objPolicy.FirewallEnabled = FALSE

This code runs fine as an administrator but users unsuprisingly get a permission denied error.  My question is this, can I run these 3 lines of code as an administrator?  I want all other code in the script to run as the logged in user.  

Many Thanks
0
Comment
Question by:bon3s
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
Taconvino earned 2000 total points
ID: 16439037
Maybe you can make these three lines as another script and run it as a startup script instead of a logon script.  Check this for push in the right direction:

http://www.rlmueller.net/LogonScriptFAQ.htm

Hope this helps!

TCV
0
 

Author Comment

by:bon3s
ID: 16444076
Thanks Taconvino, although this doesn't directly answer my question (I assume it cannot be done?), your solution is actually a far better way to do this.  Much better than having administrator username and password hard coded in the script.  I would have encrypted it, but still they're easy enough to unencrypt so it would have been a concern.

Much appreciated.
0
 
LVL 6

Expert Comment

by:Taconvino
ID: 16446051
You are very much welcome!  

I'm not sure if this can be done or not... using RunAs is not an option, and I can't think of any other way.

+TCV
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

872 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