Sign in to follow this  
Followers 0
firman

Storing A Variable

2 posts in this topic

I want to store a few values from the registry in a TXT so that after I change them... I can have another program take the variables from a txt file and replace them...in essence... I am logging in under administrator automaticaly in WINDOWS.... I then want to put the old values back so that the users do not have Administrator in their logon boxes....so.......any ideas?

Share this post


Link to post
Share on other sites



below is a copy of a portion of script thats i use to save the DefaultDomainName and DefaultUserName from the registry and puts them in back in the regirstyr with the keyname save_DefaultUserName and save_DefaultDomainName and replace them with the admin account and set the autologin stuff..

then the next run it restores them and removes the autologin.

Hope this helps you...

save:

$K = "AutoAdminLogon"
RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K, "REG_SZ","1")
$K = "DefaultDomainName"
$KV = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K)
If @error = 0 Then 
    RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "save_" & $K, "REG_SZ",$KV)
EndIf   
RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K, "REG_SZ",@ComputerName)
;
$K = "DefaultUserName"
$KV = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K)
If @error = 0 Then 
    RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "save_" & $K, "REG_SZ",$KV)
EndIf   
RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K, "REG_SZ",$USERNAME)
$K = "DefaultPassword"
RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K, "REG_SZ",$PASSWORD)

restore:

RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RUN", "SCFUpgrade")
; Reset Autologon values to blank
$K = "AutoAdminLogon"
RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K)
$K = "DefaultDomainName"
$KV = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "save_" & $K)
If @error = 0 Then 
   RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K, "REG_SZ",$KV)
   RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "save_" & $K)
EndIf
;
$K = "DefaultUserName"
$KV = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "save_" & $K)
If @error = 0 Then 
    RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K, "REG_SZ",$KV)
    RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "save_" & $K)
EndIf
$K = "DefaultPassword"
RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", $K)

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0