Jump to content

Admin Regedit Several .reg Files


Recommended Posts

Hi

I'm not realy good in scripting but I'm learning fast. Anyway. I'm try to build a script that will execute several user actions.

Mostly stuff that need to be done when a system has bin re-installed

Here is what I got

;
; Script Function:
;   Copy and run several settings to local system. For Windows XP SP3 Laptops
; This script requires full Administrative rights

#requireadmin

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "WinXP RSO", "This script is only for Notebooks.  Are you sure that you what to run?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)
;  If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(0, "WinXP ", "OK.  Bye Bye, Have a nice day :) ")
    Exit
EndIf

$var = EnvGet("AllUsersProfile")

MsgBox(0, "Copy Section", "Copying Fonts, All Users RSO!",2) 

FileCopy ( "Z:\Images\XP RIS\Kopieer_laptop\Windows\Fronts\*.*", "%windir%\Fonts\", 1)
DirCopy ("Z:\Images\XP RIS\Kopieer_laptop\Documents and Settings\All Users\", $var, 1)

MsgBox(0, "Copy Section", "Finished!",2)

MsgBox(0, "Registry", "Editing Register!",2)
$var2 = EnvGet("SystemRoot")
$var3 = $var2 & "\System32\Config\"
$var4 = $var3 & "system"
MsgBox(4096, "Path variable is:", $var4 )

$var5 = EnvGet("Userprofile")
$var6 = $var5 & "\NTUser.dat"
MsgBox(4096, "Path variable is:", $var6 )

Run("regedit.exe /s /l:"$var3 & "system"" /r:"$var2"\NTUSER.dat Z:\Images\XP RIS\Losse reg-files\2_laptop.reg")

MsgBox(0, "Registry", "Finished!",2)

The problem I'm facinfg is that when I don't run as Admin. Regedit's are blocked.

When I run as admin the scripts continues but noting is changed in the registry.

If I logon the system with admin Rights. everything works. But I need the changes to be made under a other user account.

The copy function works

Situation.

Windows XP SP3 , Logon as the user(limited Rights), network share with admin credentials (Z) here the files stand that needed to be executed

Hope anyone can help

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...