Jump to content

Storing A Variable


Recommended Posts

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?

Link to comment
Share on other sites

  • Developers

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)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...