Comandos DSQUERY e DSGET

Olá Pessoal,

Os comandos DSQUERY e DSGET tem a tarefa de realizar de forma rápida, a busca por informações no AD.

Segue um Exemplo:

dsquery user domainroot |dsget user -display -office -loscr > C:\users.txt

Neste comando, foi coletado o nome dos usuários + o campo “Script de Logon” da aba profile dos usuários.

domainroot – procura na raiz do domínio
-display – Display name dos usuários (facilitar a identificação)
-office – Exibe a localidade
-loscr – exibe o que consta neste campo, scripts que o usuário recebe
C:\users.txt – salva o resultado em arquivo .txt no caminho específicado

Utilize a sintaxe -limit 2000 (por exemplo: dsquery user -limit 2000 | dsget user) caso as linhas do arquivo não sejam suficientes para salvar as consultas.

Segue lista com mais comandos.

-dn
Displays the distinguished names   of the users.
-samid Displays the Security Account   Manager (SAM) account names of the users.
-sid Displays the user security   identifiers (SIDs).
-upn Displays the user principal   names (UPNs) of the users.
-fn Displays the first names of the   users.
-mi Displays the middle initials of   the users.
-ln Displays the last names of the   users.
-display Displays the display names of   the users.
-empid Displays the employee IDs of the   users.
-desc Displays the descriptions of the   users.
-full Displays the full names of the   users.
-office Displays the office locations of   the users.
-tel Displays the telephone numbers   of the users.
-email Displays the e-mail addresses of   the users.
-hometel Displays the home telephone   numbers of the users.
-pager Displays the pager numbers of   the users.
-mobile Displays the mobile phone   numbers of the users.
-fax Displays the fax numbers of the   users.
-iptel Displays the user IP phone   numbers.
-webpg Displays the user Web page URLs.
-title Displays the titles of the   users.
-dept Displays the departments of the   users.
-company Displays the company information   of the users.
-mgr Displays the managers of the   users.
-hmdir Displays the drive letter to   which the home directory of the user is mapped to if the home directory path   is a UNC path.
-hmdrv Displays the user’s home drive   letter if home directory is a UNC path.
-profile Displays the user profile paths.
-loscr Displays the user logon script   paths.
-mustchpwd Displays whether users must   change their passwords at the time of next logon (yes) or not (no).
-canchpwd Displays whether users can   change their password (yes) or   not (no).
-pwdneverexpires Displays whether the user   passwords never expires (yes)   or not (no).
-disabled Displays whether user accounts   are disabled for logon (yes)   or not (no).
-acctexpires Displays the dates when user   accounts expire. If the accounts never expire, this command returns never.
-reversiblepwd Displays whether the user   passwords are allowed to be stored using reversible encryption (yes) or not (no).
<UserDN>   (second variation) Required. Displays the   distinguished name of the user whose group membership you want to view.
-memberof Displays the immediate list of   groups of which the user is a member.
-expand Displays the recursively   expanded list of groups of which the user is a member. This option takes the   immediate group membership list of the user, 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.

Fonte: analistadesuporte.wordpress.com

Anúncios

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s