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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

regedit login .reg

Status
Not open for further replies.

people3

Technical User
Feb 23, 2004
276
GB
Hi

All our users run a login.bat, within this file are some regedit commands. The file runs fine on PC when the user has local admin privelages, but the regeit fails on PC where the user has non admin rights.

I don't want the user to have any admin rights, is there a way to run the regedit as a login script with admin rights

Cheers
 
If the Registry file writes only to HKEY_CURRENT_USER they wont have a problem as long as you've not disabled "Registry Editing Tools" as part of your group policy.

If the Registry file writes to HKEY_LOCAL_MACHINE then it will fail as only administrators or the system can write to the machine part of the registry. To work around this put this part of your registry file in a Startup script so its runs as the System.

Robert Bentley

SynergyworksHosting.co.uk
"reliable services at realistic prices
 
Sorted Pre Logon Branding!

I run a GPO Start up Script, that contains the following;

'Apply Registry Settings
'Screen Saver & Wallpaper Settings (Pre-Logon Environment)
WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\ScreenSaveActive", 1, "REG_SZ"
WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\ScreenSaveTimeOut", 600, "REG_SZ"
WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\ScreenSaverIsSecure", 0, "REG_SZ"
WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\SCRNSAVE.EXE", "C:\Drivers\Policy\ScreenSaver.scr", "REG_SZ"
WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\WallPaperStyle", "2", "REG_SZ"
WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\TileWallPaper", "0", "REG_SZ"
WshShell.RegWrite "HKEY_USERS\.Default\Control Panel\Desktop\WallPaper", "C:\Drivers\Policy\LogonWallpaper.bmp", "REG_SZ"

The files have to be in the C:\Drivers\Policy Folder for this to work. I've copied the files to C:\Drivers\Policy by setting a GPO Logon Script, that contains the following;

'Start of Script
'Set Variables. Do Not Change!
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")

'Copy Policy Files to Local Machine
'Create the Policy folder if it doesn't exist
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists("C:\Drivers") Then
FSO.CreateFolder("C:\Drivers")
End If
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists("C:\Drivers\Policy") Then
FSO.CreateFolder("C:\Drivers\Policy")
End If

' Copy Delprof.exe to policy folder if it doesn't exist
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists("C:\Drivers\Policy\delprof.exe") Then
fso.CopyFile "\\SERVER\Policy\Programs\delprof.exe", "C:\Drivers\Policy\delprof.exe",TRUE
End If

'Copy WallPaper.bmp to policy folder if it doesn't exist
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists("C:\Drivers\Policy\WallPaper.bmp") Then
fso.CopyFile "\\SERVER\Policy\Wallpaper\Wallpaper.bmp", "C:\Drivers\Policy\WallPaper.bmp",TRUE
End If

'Copy LogonWallPaper.bmp to policy folder if it doesn't exist
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists("C:\Drivers\Policy\LogonWallPaper.bmp") Then
fso.CopyFile "\\SERVER\Policy\Wallpaper\LogonWallPaper.bmp", "C:\Drivers\Policy\LogonWallPaper.bmp",TRUE
End If

'Copy ScreenSaver.scr to policy folder if it doesn't exist
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists("C:\Drivers\Policy\ScreenSaver.scr") Then
fso.CopyFile "\\SERVER\Policy\ScreenSaver\ScreenSaver.scr", "C:\Drivers\Policy\ScreenSaver.scr",TRUE
End If

And then finally set a GPO to handle the user’s desktop settings.

Phew!

Thanks for the help guys.

Jay

P.S. I know the scripting isn't the most elegant, but it works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top