开发者

Retrieving the Environment Starting Program for a Local Server user?

I am using a vbscript to retrieve local user account details. This script uses the Win32_Account .

An excerpt from that script:

If (bWMILocalAccounts) Then
    ReportProgress " Gathering local users"
    Set colItems = objWMIService.ExecQuery("Select Description, Name, FullNa开发者_运维知识库me, LocalAccount from Win32_UserAccount Where Domain='" & strComputerSystem_Name & "'",,48)
    Set objDbrLocalAccounts = CreateObject("ADOR.Recordset")
    objDbrLocalAccounts.Fields.Append "Description", adVarChar, MaxCharacters
    objDbrLocalAccounts.Fields.Append "UserName", adVarChar, MaxCharacters

Is it possible to read the 'Environment -> Starting Program' path?

Retrieving the Environment Starting Program for a Local Server user?


The info you're looking for is coming from ADSI, so I searched a bit and found this link on virtualizationadmin.com. It provides a nice table showing which fields in the Active Directory Users and Computers tab match their attribute for use in a script (batch, vbs, etc.).

With that info in hand, activexperts.com gives a great sample VBScript to display this info, as copied here, which you can work into your script.

Set objUser = GetObject _
  ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")

intConnectClientDrivesAtLogon = objUser.ConnectClientDrivesAtLogon
intConnectClientPrintersAtLogon = objUser.ConnectClientPrintersAtLogon
intDefaultToMainPrinter = objUser.DefaultToMainPrinter
strTerminalServicesInitialProgram = objUser.TerminalServicesInitialProgram
strTerminalServicesWorkDirectory = objUser.TerminalServicesWorkDirectory

WScript.echo "ConnectClientDrivesAtLogon: " & intConnectClientDrivesAtLogon
WScript.echo "ConnectClientPrintersAtLogon: " & _
    intConnectClientPrintersAtLogon
WScript.echo "DefaultToMainPrinter: " & intDefaultToMainPrinter
WScript.echo "TerminalServicesInitialProgram: " & _
    strTerminalServicesInitialProgram 
WScript.echo "TerminalServicesWorkDirectory: " & _
    strTerminalServicesWorkDirectory
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜