次の方法で共有


Dsget computer

 

Applies To: Windows Server 2008, Windows Server 2012, Windows 8

Displays the properties of a computer in the directory. There are two variations of this command. The first variation displays the properties of multiple computers. The second variation displays the membership information of a single computer.

Dsget is a command-line tool that is built into Windows Server 2008. It is available if you have the AD DS server role installed. To use dsget, you must run the dsget command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

dsget computer <ComputerDN> [-dn] [-samid] [-sid] [-desc] [-loc] [-disabled] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}] [-part <PartitionDN> [-qlimit] [-qused]]
dsget computer <ComputerDN> [-memberof [-expand]] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-c] [-q] [-l] [{-uc | -uco | -uci}]

Parameters

Parameter

Description

<ComputerDN> (first variation)

Required. Specifies the distinguished names of the computer object list that you want to view. If values are omitted, they are obtained through standard input (stdin) to support piping of output from another command to input of this command. Compare this parameter with ComputerDN in the second variation.

-dn

Displays the distinguished names of the computers.

-samid

Displays the Security Account Manager (SAM) account names of the computers that you specify.

-sid

Displays the computer security IDs (SIDs).

-desc

Displays the descriptions of the computers.

-loc

Displays the locations of the computers.

-disabled

Displays the status of the computer accounts. Yes indicates that the account is disabled and no indicates that the account is enabled.

<ComputerDN> (second variation)

Required. Specifies the distinguished name of the single computer you want to view.

-memberof

Displays the immediate list of groups of which the computer is a member. This takes a single target object only as input parameter (the second variation of the dsget computer command).

-expand

Displays the recursively expanded list of groups of which the computer is a member. This option takes the immediate group membership list of the computer, as returned by the -memberof parameter, and then recursively expands each group in this list to determine its group memberships as well to arrive at a complete closure set of the groups.

{-s <Server>| -d <Domain>}

Connects the computer to a remote server or domain that you specify. By default, dsget connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password> | *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsget prompts you for a password.

-c

Reports errors, but continues with the next object in the argument list when you specify multiple target objects (continuous operation mode). If you do not supply this parameter, dsget exits when the first error occurs.

-q

Suppresses all output to standard output (quiet mode).

-l

Displays entries in a list format. By default, dsget displays entries in a table format.

{-uc | -uco | -uci}

Specifies that dsget formats output or input data in Unicode. The following list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a Unicode format for input from a pipe (|) or a file.

-part <PartitionDN>

Connects to the directory partition with the distinguished name of PartitionDN.

-qlimit

Displays the effective quota of the computer in the directory partition that you specify for the -part parameter.

-qused

Displays how much of its quota a computer has used in the directory partition that you specify for the -part parameter.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsget obtains the target object from standard input (stdin). Dsget can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • Use dsget to view the properties of a specific object in the directory.

  • As a result of dsquery searches, you can pipe returned objects to dsget and obtain object properties.

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=DC2,OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To display the descriptions of all computers in an organizational unit (OU) named Test whose name starts with "tst", type:

dsquery computer OU=Test,DC=Contoso,DC=Com -name tst* | dsget computer -desc

To display the list of groups, recursively expanded, to which the MyDBServer computer belongs, type:

dsget computer CN=MyDBServer,CN=computers,DC=Contoso,DC=Com -memberof -expand

Additional references

Command-Line Syntax Key

Dsget

Dsget contact

Dsget group

Dsget ou

Dsget server

Dsget user

Dsget subnet

Dsget site

Dsget quota

Dsget partition