Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a few scripts that set and get user expiration using VBS... however, I am wondering where this information is stored. Is it in the registry? If so, what key should I be looking for?

My VBS Example:

' Retrieve local computer name.
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

' Specify local user name.
strName = "Loaner"

' Bind to local user object.
Set objUser = GetObject("WinNT://" & strComputer & "/" & strName & ",user")


Wscript.echo "This computer is due back to the office on: " &   objUser.AccountExpirationDate

Would like to know if objUser.AccountExpirationDate is set somewhere in the registry, even if its stored but not easily editable.

share|improve this question
    
Hmm, but it has to be stored somewhere... because it is not a domain user, but a local user that is set to expire. The user account will expire regardless of a domain or even internet connection. If its not in the registry, then where? –  Tyler Oct 17 '13 at 14:26
2  
Somewhere in HKEY_USERS most likely. Run Process Monitor, run your script and check which values were manipulated. –  Oliver Salzburg Oct 17 '13 at 14:29
1  
Do you mean the one you can set with net user %username% /expires:never? (The "Account expires" one) I think that one is somewhere in HKLM\SAM\SAM\DOMAINS\Account\Users. You do know you can set it for local users with net user %username% /expires:never? (and view it with net user %username%) –  Rik Oct 17 '13 at 15:23
    
+1 for also identifying it was in the SAM. I gave a much more simplified version of the vbscript, there are reasons we went that route. Either way, FWIW, redirecting the same as in my comment on the accepted answer didn't actually work. It broke things badly. However, that was using the registry Hive, I'm going to attempt to simply redirect that specific file in the filesystem and see how it fares. –  Tyler Oct 17 '13 at 16:03

1 Answer 1

up vote 2 down vote accepted

This settings resides in the SAM file, the same way in a Windows domain.

The SAM file is in Hive format, which means you can load it through RegEdit (or Reg Load in CLI), and do whatever you like with it.

I've tried it, but couldn't get anything.

There are tools like the ones on Hiren's boot CD that let you manipulate the SAM, so maybe you could get the source code of one.

share|improve this answer
    
Kudos! Thanks a lot. I took Oliver's suggestion and was using Process Monitor... after getting the filters just right I noticed that the changes were being made in the SAM. To give some background in case it helps anyone. We had DeepFreeze on a machine, but we are able with some other software to specify what registry hive's we want to persist. Because this machine is intended as a loaner we want the user expiration to persist (when the user expires our end users are much more likely to bring computers back on time). Anyway, thanks for the help just persisting the SAM now and it may work. –  Tyler Oct 17 '13 at 15:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.