检索本地服务器用户的环境启动程序?

发布于 2024-12-08 16:20:13 字数 832 浏览 6 评论 0原文

我正在使用 vbscript 来检索本地用户帐户详细信息。此脚本使用 Win32_Account

该脚本的摘录:

If (bWMILocalAccounts) Then
    ReportProgress " Gathering local users"
    Set colItems = objWMIService.ExecQuery("Select Description, Name, FullName, 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

是否可以阅读“环境 ->”启动程序的路径?

在此处输入图像描述

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, FullName, 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?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冬天的雪花 2024-12-15 16:20:13

您正在寻找的信息来自 ADSI,所以我搜索了一下并找到了这个 链接。它提供了一个很好的表格,显示“Active Directory 用户和计算机”选项卡中的哪些字段与其在脚本(批处理、vbs 等)中使用的属性相匹配。

有了这些信息,activexperts.com 提供了一个很棒的 VBScript 示例 显示此信息(如此处复制的),您可以将其添加到脚本中。

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文