
Re: Re: Purpose of the STATE key located in user's profiles?
In-Line
On Tue, 19 Dec 2006 19:16:03 -0800, Mike S <msoultan@csulb.edu> wrote:
>Jerold Schulman wrote:
>
>Hey Jerold,
>Just so you know, the reason I am asking this information is because I
>want to know when a user gets logged in with a temporary profile. I am
>NOT trying to figure out why the user got logged in with a temp profile
>(I already know why), I just want to be able to detect if it happens
>mitigate the situation gracefully.
>
>So, I just logged in with an account that got loaded into a temp profile
>(Lotus Notes decided it wanted to hold the ntuser.dat file open, if
>you're curious). My SID is the following:
>
>S-1-5-21-1534095646-1438609452-5522801-16269
>
>In the registry, I have the following values under this key:
>
>...\ProfileList\S-1-5-21-1534095646-1438609452-5522801-16269
>
> - State: 19204 (decimal)
> - ProfilePath: %SystemDrive%\Documents and Settings\TEMP
>
19204 is hex 4b04 or
0010101100000100 or
004 = PROFILE_NEW_LOCAL
100 = PROFILE_ADMIN_USER
200 = DEFAULT_NET_READY
800 = PROFILE_TEMP_ASSIGNED
>It seems that Windows also makes a backup of my original profile before
>logging me in with the above path:
>
>...\ProfileList\S-1-5-21-1534095646-1438609452-5522801-16269.bak\
>
> - State: 33024 (decimal)
> - ProfilePath: %SystemDrive%\Documents and Settings\msoultanian
>
This is hex 8100 or
1000000100000000 or
100 = PROFILE_ADMIN_USER
See tip 8968 » How can I convert a hexadecimal number to decimal, or a decimal number to hexadecimal, in a batch?
in the 'Tips & Tricks' at [url]http://www.jsifaq.com[/url]
The perform the test in batch, assume %State% contains the state:
call hexec %State% hex
set /a ans="%hex%&0x800"
if %ans% EQU 2048 goto Temp_Profile
If you don't want to use a 3rd party routine:
set /a ans1=%State% / 2048
set /a ans2=%State%%%2048
set /a ans3=(%ans1% * 2048) + %ans2%
set /a ans="%ans3%&0x800"
if %ans% EQU 2048 goto Temp_Profile
[vbcol=seagreen]
>
>So, that is where I am getting these values. My goal here is for my
>VBScript to be able to read in the State value, interpret the value so I
>can accurately know whether or not the user is logged in with a
>temporary profile, and then act accordingly. I could just test to see
>if it's above 19000, but I really don't like doing that because it seems
>clumsy.
>
>I haven't figured out how these values should match up with the values I
>got from the Microsoft technician so that's where I'm hoping someone
>will be able to help out.
>
>Just for the sake of information, here are some other state values that
>I've found assigned to users and their associated binary and hex values:
>
>1000000100000100 - 33028 (8104h) - temporary user backup
>1000000100000000 - 33024 (8100h) - also from a temporary user backup
> 100101100000100 - 19204 (4B04) - temporary account
> 1100000100 - 772 (304h) - not sure
> 100000000 - 256 (100h) - seems like normal status
>
>So, any thoughts? I really appreciate your help as I have been trying
>to figure this out for a very looooooong time!
>
>Thanks,
>Mike
>
>
>location:
>flag settings on the profile:
>of 33028. Any ideas?!
>be useful for profile-type.
>programmatically in a logon script, otherwise yeah, that would probably
>work.
Jerold Schulman
Windows Server MVP
JSI, Inc.
[url]http://www.jsiinc.com[/url]
[url]http://www.jsifaq.com[/url]