| Author |
Message |
Guest
|
Posted:
Tue Jan 11, 2005 9:35 am Post subject:
How to get the User Name? |
|
|
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros |
|
| Back to top |
|
 |
KM
Guest
|
Posted:
Tue Jan 11, 2005 9:35 am Post subject:
Re: How to get the User Name? |
|
|
Kiros,
It sounds a bit weird that you have UserX different user names on your machines with the same image. Why not the same user name for
all?
Another thing to mention is you don't necessarily have to reboot if you changed Autologon settings and want to apply the new
settings.
All you have to do is:
- change the Autologon settings
- logoff (there is a bunch of way to do that but easiest - search Net for logoff.exe or use "shutdown -l" command)
- Make sure this STRING registry value is set to "1": [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],
"ForceAutoLogon".
Anyway, to answer your question.. You have many ways to know the current logon user name but the easiest ones would be:
- use GetUserName[Ex] API: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getusername.asp
- read the following reg.value directly: [HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer],"Logon User Name".
KM
| Quote: | Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros |
|
|
| Back to top |
|
 |
Nick
Guest
|
Posted:
Wed Jan 12, 2005 8:11 am Post subject:
Re: How to get the User Name? |
|
|
hi
it seems that all logon and logoff actions are just about to upgrade
some software/settings, i think runas service is a good choice for your
purpose, no matter who is the current user, just do what you want to do
running as administrators group member. and we've been taking advatage of it
for quite a while.
nick
<kiros@termtek.com.tw> wrote in message
news:1105433218.016434.235520@f14g2000cwb.googlegroups.com...
| Quote: | Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
KM
Guest
|
Posted:
Wed Jan 12, 2005 8:27 am Post subject:
Re: How to get the User Name? |
|
|
Nick,
If you're referring to runas command, how do you supply the used account password?
Some other tools (freeware/shareware) may be used but from MS you have only API:
http://groups-beta.google.com/group/microsoft.public.windowsxp.embedded/browse_frm/thread/bf0db3509ec504fc#cb55c9de50dae623
KM
| Quote: | hi
it seems that all logon and logoff actions are just about to upgrade
some software/settings, i think runas service is a good choice for your
purpose, no matter who is the current user, just do what you want to do
running as administrators group member. and we've been taking advatage of it
for quite a while.
nick
kiros@termtek.com.tw> wrote in message
news:1105433218.016434.235520@f14g2000cwb.googlegroups.com...
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
Guest
|
Posted:
Wed Jan 12, 2005 5:16 pm Post subject:
Re: How to get the User Name? |
|
|
Hi KM
Thanks for you advice.
Yes, I have different user names on the machines with the same image.
For some reason, i must assign different UserX name.
I will try these ways, thanks.
But i still have one question.
How do i get the UserX name in the "Administrator" account?
Because i have two accounts in my XPE image.
Thanks
Kiros
KM wrote:
| Quote: | Kiros,
It sounds a bit weird that you have UserX different user names on
your machines with the same image. Why not the same user name for
all?
Another thing to mention is you don't necessarily have to reboot if
you changed Autologon settings and want to apply the new
settings.
All you have to do is:
- change the Autologon settings
- logoff (there is a bunch of way to do that but easiest - search
Net for logoff.exe or use "shutdown -l" command)
- Make sure this STRING registry value is set to "1":
[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],
"ForceAutoLogon".
Anyway, to answer your question.. You have many ways to know the
current logon user name but the easiest ones would be:
- use GetUserName[Ex] API:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getusername.asp
- read the following reg.value directly:
[HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer],"Logon User |
Name".
| Quote: |
KM
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros |
|
|
| Back to top |
|
 |
KM
Guest
|
Posted:
Wed Jan 12, 2005 6:54 pm Post subject:
Re: How to get the User Name? |
|
|
Kiros,
Are you asking how to rename the Administrator account?
AFAIK, you can only do that at run time (with command line tools or GUI).
Or you can add UserX account to Admin group (look at the cmiUserGroup property of "User Account" component).
KM
| Quote: | Hi KM
Thanks for you advice.
Yes, I have different user names on the machines with the same image.
For some reason, i must assign different UserX name.
I will try these ways, thanks.
But i still have one question.
How do i get the UserX name in the "Administrator" account?
Because i have two accounts in my XPE image.
Thanks
Kiros
KM wrote:
Kiros,
It sounds a bit weird that you have UserX different user names on
your machines with the same image. Why not the same user name for
all?
Another thing to mention is you don't necessarily have to reboot if
you changed Autologon settings and want to apply the new
settings.
All you have to do is:
- change the Autologon settings
- logoff (there is a bunch of way to do that but easiest - search
Net for logoff.exe or use "shutdown -l" command)
- Make sure this STRING registry value is set to "1":
[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],
"ForceAutoLogon".
Anyway, to answer your question.. You have many ways to know the
current logon user name but the easiest ones would be:
- use GetUserName[Ex] API:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getusername.asp
- read the following reg.value directly:
[HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer],"Logon User
Name".
KM
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
Bernhard
Guest
|
Posted:
Wed Jan 12, 2005 8:46 pm Post subject:
Re: How to get the User Name? |
|
|
Hi KM,
there is also a freeware runas add-on that allows to supply
the password in a script:
http://www.commandline.co.uk/sanur/
Regards,
Bernhard
KM wrote:
| Quote: | Nick,
If you're referring to runas command, how do you supply the used
account password?
Some other tools (freeware/shareware) may be used but from MS you
have only API:
http://groups-beta.google.com/group/microsoft.public.windowsxp.embedded/browse_frm/thread/bf0db3509ec504fc#cb55c9de50dae623
KM
hi
it seems that all logon and logoff actions are just about to
upgrade
some software/settings, i think runas service is a good choice for
your
purpose, no matter who is the current user, just do what you want
to do
running as administrators group member. and we've been taking
advatage of it
for quite a while.
nick
kiros@termtek.com.tw> wrote in message
news:1105433218.016434.235520@f14g2000cwb.googlegroups.com...
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
KM
Guest
|
Posted:
Thu Jan 13, 2005 12:15 am Post subject:
Re: How to get the User Name? |
|
|
Bernhard,
Useful utility.
Thanks for the link.
--
Regards,
KM, BSquare Corp.
| Quote: | Hi KM,
there is also a freeware runas add-on that allows to supply
the password in a script:
http://www.commandline.co.uk/sanur/
Regards,
Bernhard
KM wrote:
Nick,
If you're referring to runas command, how do you supply the used
account password?
Some other tools (freeware/shareware) may be used but from MS you
have only API:
http://groups-beta.google.com/group/microsoft.public.windowsxp.embedded/browse_frm/thread/bf0db3509ec504fc#cb55c9de50dae623
KM
hi
it seems that all logon and logoff actions are just about to
upgrade
some software/settings, i think runas service is a good choice for
your
purpose, no matter who is the current user, just do what you want
to do
running as administrators group member. and we've been taking
advatage of it
for quite a while.
nick
kiros@termtek.com.tw> wrote in message
news:1105433218.016434.235520@f14g2000cwb.googlegroups.com...
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
Guest
|
Posted:
Thu Jan 13, 2005 9:37 am Post subject:
Re: How to get the User Name? |
|
|
Hi KM
Thanks for your advice.
I think i don't need to rename the Adminsitrator account or User
account.
Because i must upgrade some application with "Administrator"
account.(Logon with "Administrator")
When i upgrade finished, i must reboot and logon with "User"
automatically.(Logon with "UserX")
So i have to know what user name with "User" account and i can set the
registry key of autologon
and let the machine autologon with "UserX".
So how do i get the UserX name when i already logon with the
"Administrator" account?
Thanks
Kiros
KM wrote:
| Quote: | Kiros,
Are you asking how to rename the Administrator account?
AFAIK, you can only do that at run time (with command line tools or
GUI).
Or you can add UserX account to Admin group (look at the cmiUserGroup
property of "User Account" component).
KM
Hi KM
Thanks for you advice.
Yes, I have different user names on the machines with the same
image.
For some reason, i must assign different UserX name.
I will try these ways, thanks.
But i still have one question.
How do i get the UserX name in the "Administrator" account?
Because i have two accounts in my XPE image.
Thanks
Kiros
KM wrote:
Kiros,
It sounds a bit weird that you have UserX different user names on
your machines with the same image. Why not the same user name for
all?
Another thing to mention is you don't necessarily have to reboot
if
you changed Autologon settings and want to apply the new
settings.
All you have to do is:
- change the Autologon settings
- logoff (there is a bunch of way to do that but easiest -
search
Net for logoff.exe or use "shutdown -l" command)
- Make sure this STRING registry value is set to "1":
[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],
"ForceAutoLogon".
Anyway, to answer your question.. You have many ways to know the
current logon user name but the easiest ones would be:
- use GetUserName[Ex] API:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getusername.asp
- read the following reg.value directly:
[HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer],"Logon
User
Name".
KM
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or
not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
KM
Guest
|
Posted:
Thu Jan 13, 2005 9:37 am Post subject:
Re: How to get the User Name? |
|
|
Kiros,
You have a few ways to accomplish what you want.
The most proper way:
- You can enumerate folder names under "%SystemDrive%\Documents and Settings" (more exactly, this path is stored under
[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList],"ProfilesDirectory").
Although sometimes (depends on the system designer wish) the folder names may nto reflect the actual user names.
So you will be interested in the user registry hive: %SystemDrive%\Documents and Settings\LocalService\NTUSER.DAT.
or
- You can enumerate registry keys under [HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList]. each subkey there
reflects a user account setting. Read ProfileImagePath value from a subkey.
After any of the enumeration above, you read user profile image (%SystemDrive%\Documents and Settings\LocalService\NTUSER.DAT)
with reg.exe tool and then just read [Software\Microsoft\Windows\CurrentVersion\Explorer],"Logon User Name" value of the loaded
profile hive. This way you know the profile user name.
I believe there are even easier ways to know otehr user account names.
For example, you you enumarate registry value names under [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths],
you will get all the user names.
Or using WMI interfaces you can get the user name list from a script or a program.
KM
| Quote: | Hi KM
Thanks for your advice.
I think i don't need to rename the Adminsitrator account or User
account.
Because i must upgrade some application with "Administrator"
account.(Logon with "Administrator")
When i upgrade finished, i must reboot and logon with "User"
automatically.(Logon with "UserX")
So i have to know what user name with "User" account and i can set the
registry key of autologon
and let the machine autologon with "UserX".
So how do i get the UserX name when i already logon with the
"Administrator" account?
Thanks
Kiros
KM wrote:
Kiros,
Are you asking how to rename the Administrator account?
AFAIK, you can only do that at run time (with command line tools or
GUI).
Or you can add UserX account to Admin group (look at the cmiUserGroup
property of "User Account" component).
KM
Hi KM
Thanks for you advice.
Yes, I have different user names on the machines with the same
image.
For some reason, i must assign different UserX name.
I will try these ways, thanks.
But i still have one question.
How do i get the UserX name in the "Administrator" account?
Because i have two accounts in my XPE image.
Thanks
Kiros
KM wrote:
Kiros,
It sounds a bit weird that you have UserX different user names on
your machines with the same image. Why not the same user name for
all?
Another thing to mention is you don't necessarily have to reboot
if
you changed Autologon settings and want to apply the new
settings.
All you have to do is:
- change the Autologon settings
- logoff (there is a bunch of way to do that but easiest -
search
Net for logoff.exe or use "shutdown -l" command)
- Make sure this STRING registry value is set to "1":
[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon],
"ForceAutoLogon".
Anyway, to answer your question.. You have many ways to know the
current logon user name but the easiest ones would be:
- use GetUserName[Ex] API:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getusername.asp
- read the following reg.value directly:
[HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer],"Logon
User
Name".
KM
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or
not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
Nick
Guest
|
Posted:
Thu Jan 13, 2005 2:56 pm Post subject:
Re: How to get the User Name? |
|
|
KM
sorry, i forgot to mention such things. and sure we wrapped runas that
can feed password to it.
thanks
nick
"KM" <konstmor@nospam_yahoo.com> wrote in message
news:u0979pN%23EHA.2984@TK2MSFTNGP09.phx.gbl...
| Quote: | Bernhard,
Useful utility.
Thanks for the link.
--
Regards,
KM, BSquare Corp.
Hi KM,
there is also a freeware runas add-on that allows to supply
the password in a script:
http://www.commandline.co.uk/sanur/
Regards,
Bernhard
KM wrote:
Nick,
If you're referring to runas command, how do you supply the used
account password?
Some other tools (freeware/shareware) may be used but from MS you
have only API:
http://groups-beta.google.com/group/microsoft.public.windowsxp.embedded/browse_frm/thread/bf0db3509ec504fc#cb55c9de50dae623
KM
hi
it seems that all logon and logoff actions are just about to
upgrade
some software/settings, i think runas service is a good choice for
your
purpose, no matter who is the current user, just do what you want
to do
running as administrators group member. and we've been taking
advatage of it
for quite a while.
nick
kiros@termtek.com.tw> wrote in message
news:1105433218.016434.235520@f14g2000cwb.googlegroups.com...
Hi all
I build the XPE image with two accounts.
One is "Adminsitrator" and the other is "User".
Default logon is "User".
Now i want to setup or upgrade my application automatically.
So i design some simple rules to do that.
As below:
1.Default logon is "User" and check if you want to update or not.
2.If "Yes", i will reboot and logon with "Administrator".
And when you finish that, it will reboot again and logon
with "User" automatically.
PS: I can set the registry key of "DefaultUserName" to autologon
with "Administrator" or "User".
3.If "No", nothing to do.
It can be done and works fine.
But now i have some problem. If i have 10 machines with XPE.
The "User" name is different with each machine.
For example, "User1", "User2", "User3",...
The "Administrator" name is the same with each machine.
So when i upgrade finished, i must logon with "User" again.
But now the "User" name of each machine is different.
So i want to know the "User" name with each machine and set the
registry key to autologn.
How do i get the "User" name?
Thanks
Kiros
|
|
|
| Back to top |
|
 |
|
|
|
|