I don't know how to get what is the Startup folder of an user other than the current logged on. That is, If I use the SpecialFolders("Startup") Property of WshShell class, I get the the Startup folder for the current user, not for a specified user.
Note I'm getting this information on the T-9 Phase of Windows Setup, therefore I have another handicap: The UserDomain Property of WshNetwork class don't work. I did the following:
Set useracc = GetObject( _
"winmgmts:\root\cimv2:Win32_UserAccount.Domain='" & _
CreateObject("WScript.Network").UserDomain & "',Name='" & SPECIFIED_USER & _
"'" _
)
But I have a Run-Time error. The UserDomain Property returns a Null string (can't find the user domain).
I used the Win32_UserAccount class in order to get the user's SID. With his SID, I could access to the corresponding Registry key to query his Startup Folder:
' Get the Startup folder of SPECIFIED_USER by using his SID. x = .RegRead( _ "HKEY_USERS\" & useracc.SID & "\Software\Microsoft\Windows\CurrentVersion" & _ "\Explorer\Shell Folders\Startup" _ )
But the previous code don't work because the first snippet is unable to get the User's SID.
Any idea to workaround this? Is necessary to get the User's SID or is there an easier way? ONLY I want to get the Startup folder for SPECIFIED_USER.
Thanks very much for your help
This post has been edited by ponghy: 08 November 2005 - 02:18 AM



Help

Back to top









