Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript Windows 7

Status
Not open for further replies.

GrimR

IS-IT--Management
Jun 17, 2007
1,149
ZA
Will vbscript logon scripts work on Windows 7?

MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP
 
They work for me. Although, they are launched using AD.

VBScript still works in Windows 7 but there is an effort to migrate scripting to PowerShell (from what I've read/heard)

-Geates
 
Works just fine as far as I can tell. Several of my scripts still work just fine.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
...oh...UAC is a pain still though...so launch under admin or turn it off.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
If the script needs to run under admin privs (generally for writes to protected folders), here's a sub to detect whether or not the script is running in an elevated window...

Code:
Sub CheckForElevation(oShell)
	' Verifies Script is running in an elevated context. (For Vista or later OS)
	Dim oExec, sStdOut

	Set oExec = oShell.Exec("whoami /groups")

	' Read output
	sStdOut = oExec.StdOut.ReadAll

	' Check for Elevated Token "S-1-16-12288", quit if missing.
	If InStr(1, sStdOut, "S-1-16-12288", vbTextCompare) = 0 Then
		MsgBox "Script must be run with Elevated Privileges in Vista " & _
			"or higher.  Execute script again from an Elevated " & _
			"Command Prompt."
		WScript.Sleep 15000
		oIE.Quit
		WScript.Quit
	End If
End Sub 'CheckForElevation

PSC
[—] CCNP [•] CCSP [•] MCITP: Enterprise Admin [•] MCSE [—]

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Thanks, good to hear they still work and not disabled or removed. I didn't like UAC in Vista and I'm sure it's the first thing I disable in Win7.

MCITP:EA/SA, MCSE, MCSA, MCDBA, MCTS, MCP+I, MCP
 
UAC in Windows 7 is much better. Unlike Vista it has 4 levels.

Most scripts will work fine in Windows 7 however you will find that some scripts that write to the registry will not. This is especially the case with x64 installations where there are actually 2 registries, x86 and x64. Permissions issues exist even with UAC turned off (check default settings for HKLM\Software\Microsoft\Windows\CurrentVersion\ControlPanel\don't load and you will see that TrustedInstaller has ownership and you have to assign rights to Administrators to delete the entries in there to show all control panel icons).

Regarding the comments on PowerShell, PowerShell is very powerful and truly awesome but it won't replace VBScript for login scripts anytime soon. AD only recognizes VBS, CMD and BAT files in group polices, plus the PowerShell PS1 files are not associated with an executable. In fact, if you want to run a PowerShell script as a login script you have to call it with VBScript ( If aything will replace VBScript Login Scripts it will be Group Policy Preferences.

Because Windows 7 includes VBScript, it will be supported by MS for at least another 10 years since that is the minimum that Windows 7 will be supported.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top