Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 20th, 2008, 04:28 PM
zambrtp zambrtp is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 15 zambrtp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 6 sec
Reputation Power: 0
VBScript - Edit Windows environment via vb

Does anyone know how to do the following via wsf and vb scripts..I searched internet but could only find a partial answer...Im trying to do a noninteractive installtion of many applications that need these options...

Click the StartSettingsControl PanelAdd or Remove Programs start menu option

In the Add or Remove Programs window, click the Add/Remove Windows Components button

In the Windows Components Wizard: Windows Components window, de-select the following option under components:

• Internet Explorer Enhanced Security Configuration
Click ‘Next’
Click ‘Finish’

Close the Add or Remove Programs window

Modify the Data Execution Prevention (DEP) settings to allow the IWPC installers to run by doing the following:

Click the StartSettingsControl PanelSystem start menu option
In the System Properties window, click the Advanced tab
Under the Performance section, click the Settings button
In the Performance Options window
Click the Data Execution Prevention tab
Select Turn on DEP for essential Windows programs and services only radio option
Click the OK button

In the System Properties window, click the OK button

Reply With Quote
  #2  
Old October 21st, 2008, 01:30 PM
Nilpo's Avatar
Nilpo Nilpo is online now
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
It would be too hard to automate those dialog windows. It's better to revert to the command line.
vb Code:
Original - vb Code
  1. Set WshShell = CreateObject("WScript.Shell")
  2. ' Turn off IE Enhanced Security Configuration
  3. WshShell.Exec("rundll32.exe setupapi.dll,InstallHinfSection IESoftenAdmin 128 %windir%\inf\IEHARDEN.INF")
  4. ' Enable DEP
  5. WshShell.Exec("bcdedit.exe /set {current} nx AlwaysOn")
Note that uninstalling IE's ESC does require a system reboot.
__________________
Click the image if at any point you don't like my decision.

Scripting problems? Windows questions? Ask the Windows Guru!


Reply With Quote
  #3  
Old October 22nd, 2008, 10:18 AM
zambrtp zambrtp is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 15 zambrtp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 6 sec
Reputation Power: 0
Nilpo
I read that the
command " Turn off IE Enhanced Security Configuration
WshShell.Exec("rundll32.exe setupapi.dll,InstallHinfSection IESoftenAdmin 128 %windir%\inf\IEHARDEN.INF")" was just for Administrators...or did I understand it wrong...I need it to be off for ALL users all the time...
THanks for all your help....I am still working the other issue and Ill post again when I figure something out or figure out errors...


Quote:
Originally Posted by Nilpo
It would be too hard to automate those dialog windows. It's better to revert to the command line.
vb Code:
Original - vb Code
  1. Set WshShell = CreateObject("WScript.Shell")
  2. ' Turn off IE Enhanced Security Configuration
  3. WshShell.Exec("rundll32.exe setupapi.dll,InstallHinfSection IESoftenAdmin 128 %windir%\inf\IEHARDEN.INF")
  4. ' Enable DEP
  5. WshShell.Exec("bcdedit.exe /set {current} nx AlwaysOn")
Note that uninstalling IE's ESC does require a system reboot.

Reply With Quote
  #4  
Old October 22nd, 2008, 11:07 AM
Nilpo's Avatar
Nilpo Nilpo is online now
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by zambrtp
Nilpo
I read that the
command " Turn off IE Enhanced Security Configuration
WshShell.Exec("rundll32.exe setupapi.dll,InstallHinfSection IESoftenAdmin 128 %windir%\inf\IEHARDEN.INF")" was just for Administrators...or did I understand it wrong...I need it to be off for ALL users all the time...
It must be run by a user with administrator privileges, but the effects are global.

Reply With Quote
  #5  
Old October 22nd, 2008, 11:16 AM
zambrtp zambrtp is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 15 zambrtp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 6 sec
Reputation Power: 0
Nilpo
When I run the code it says Untermiated opauq block and highlights the last line....also i need the DEP setting to be Turn on DEP for essential Windows programs and services only
thanks again for your help...oh I am running it command line is that right?
Quote:
Originally Posted by zambrtp
Nilpo
I read that the
command " Turn off IE Enhanced Security Configuration
WshShell.Exec("rundll32.exe setupapi.dll,InstallHinfSection IESoftenAdmin 128 %windir%\inf\IEHARDEN.INF")" was just for Administrators...or did I understand it wrong...I need it to be off for ALL users all the time...
THanks for all your help....I am still working the other issue and Ill post again when I figure something out or figure out errors...

Reply With Quote
  #6  
Old October 23rd, 2008, 01:30 AM
Nilpo's Avatar
Nilpo Nilpo is online now
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by zambrtp
Nilpo
When I run the code it says Untermiated opauq block and highlights the last line....also i need the DEP setting to be Turn on DEP for essential Windows programs and services only
thanks again for your help...oh I am running it command line is that right?
I guess I'm a little confused about where this error is coming from. The code I provided should be saved to a .vbs file and run under WSH. This can generally be done by double-clicking the file you just created.

Since this is not a standard VBScript error, I'm not sure where it's coming from.

Reply With Quote
  #7  
Old October 23rd, 2008, 09:10 AM
zambrtp zambrtp is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 15 zambrtp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 6 sec
Reputation Power: 0
yeah ...dont listen to me....Its because I was trying everything to make it run...ignore that error...

Is there a way to make the command window PAUSE besides SLEEP...I see some kind of message but it flashes so fast I cant read it....

Reply With Quote
  #8  
Old October 24th, 2008, 03:47 AM
Nilpo's Avatar
Nilpo Nilpo is online now
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by zambrtp
yeah ...dont listen to me....Its because I was trying everything to make it run...ignore that error...

Is there a way to make the command window PAUSE besides SLEEP...I see some kind of message but it flashes so fast I cant read it....
Yes and no, but regardless, that output should be captured in the StdOut stream. You could also "redirect" the output to a text file as well by changing the command slightly.
vb Code:
Original - vb Code
  1. WshShell.Exec("bcdedit.exe /set {current} nx AlwaysOn >> somefile.txt")
This will not change the functionality of the script or the program, but it should create a text file after it runs with all of the programs output.

The reason I say yes and no to your question is that you CAN force the command window to remain open, but that will pause your script execution in many cases causing it not to terminate properly. To do that just prepend "cmd /k" to the beginning of your command line. The K switch instructs the command window to execute and remain open. Your script may not complete until this window is manually closed.
vb Code:
Original - vb Code
  1. WshShell.Exec("cmd.exe /k bcdedit.exe /set {current} nx AlwaysOn")

Reply With Quote
  #9  
Old October 25th, 2008, 02:06 PM
zambrtp zambrtp is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 15 zambrtp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 6 sec
Reputation Power: 0
Windows Server 2003 Std Eddoesnt have bcdedit...is there something else I can use?

Quote:
Originally Posted by Nilpo
Yes and no, but regardless, that output should be captured in the StdOut stream. You could also "redirect" the output to a text file as well by changing the command slightly.
vb Code:
Original - vb Code
  1. WshShell.Exec("bcdedit.exe /set {current} nx AlwaysOn >> somefile.txt")
This will not change the functionality of the script or the program, but it should create a text file after it runs with all of the programs output.

The reason I say yes and no to your question is that you CAN force the command window to remain open, but that will pause your script execution in many cases causing it not to terminate properly. To do that just prepend "cmd /k" to the beginning of your command line. The K switch instructs the command window to execute and remain open. Your script may not complete until this window is manually closed.
vb Code:
Original - vb Code
  1. WshShell.Exec("cmd.exe /k bcdedit.exe /set {current} nx AlwaysOn")

Reply With Quote
  #10  
Old October 25th, 2008, 02:46 PM
zambrtp zambrtp is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2008
Posts: 15 zambrtp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 6 sec
Reputation Power: 0
I tried to run the bcdedit command line...and realized its not available on windows 2003 server...is there another command I can use instead to change the DEP options?

Quote:
Originally Posted by zambrtp
Windows Server 2003 Std Eddoesnt have bcdedit...is there something else I can use?

Reply With Quote