简体   繁体   English

PowerShell中的活动目录

[英]Active directory in PowerShell

Can someone give me a brief Knowledge about Active directory in PowerShell. 有人可以简要介绍一下PowerShell中的Active Directory。 I just want to get the basic concept of active directory in PowerShell. 我只想了解PowerShell中活动目录的基本概念。

You might want to migrate this to ServerFault. 您可能需要将此迁移到ServerFault。

PowerShell allows you to perform some Active Directory queries/functions using commands provided by Microsoft. PowerShell允许您使用Microsoft提供的命令来执行一些Active Directory查询/功能。

Your question is too general for me to answer but I can give you an example. 您的问题太笼统,我无法回答,但我可以举个例子。 I think this will help you. 我认为这会对您有所帮助。

Suppose I want to retrieve all Active Directory users: 假设我要检索所有Active Directory用户:

$users = Get-ADUser

Now suppose I want to retrieve only those users who are Enabled . 现在假设我只想检索那些Enabled用户。 I look up the documentation for Get-ADUser and see that I need to add the switch -LDAPFilter : 我查看了Get-ADUser的文档,发现我需要添加开关-LDAPFilter

Get-ADUser -LDAPFilter "(&(sAMAccountName=b*) (!userAccountControl:1.2.840.113556.1.4.803:=2))"

Now suppose I only need the username and given name of the user (instead of all the properties). 现在,假设我只需要用户名和用户名(而不是所有属性)。 I add the -Properties switch: 我添加了-Properties开关:

Get-ADUser -LDAPFilter "(&(sAMAccountName=b*) (!userAccountControl:1.2.840.113556.1.4.803:=2))" -Properties sAMAccountName, givenName, sn, enabled

In general, PowerShell + AD allows you to query your Active Directory and even modify it in some cases. 通常,PowerShell + AD允许您查询Active Directory,甚至在某些情况下可以对其进行修改。 Certain AD functionality (Exchange for instance) requires separately-loaded or special snap-ins. 某些AD功能(例如Exchange)需要单独加载或特殊的管理单元。

But to your question, PowerShell + AD is exactly that - PowerShell with an interface to Active Directory. 但是给您的问题是,PowerShell + AD就是这样-具有Active Directory接口的PowerShell。

Basically the Powershell for Active Diretory allows you to create scripts to do a bunch of stuff. 基本上,Active Diretory的Powershell允许您创建脚本来执行很多工作。 For example you can create a lots of users in seconds, or you can check all the users properties relatives or specific for reports. 例如,您可以在几秒钟内创建大量用户,或者可以检查所有用户的属性亲戚或特定于报表的用户。

Here's one of my contributions in technet for example. 例如,这是我对technet的贡献之一。 https://gallery.technet.microsoft.com/exchange/Get-AD-Active-Users-cf308fec https://gallery.technet.microsoft.com/exchange/Get-AD-Active-Users-cf308fec

I'll be doing this with html and jquery soon. 我将很快使用html和jquery进行此操作。 not only for csv. 不仅适用于csv。

If you want to expand your knowledge about AD powershell I'll recomend you to take this free course in MVA 如果您想扩展有关AD Powershell的知识,我建议您参加MVA的免费课程

http://www.microsoftvirtualacademy.com/training-courses/using-powershell-for-active-directory http://www.microsoftvirtualacademy.com/training-courses/using-powershell-for-active-directory

Have a nice day! 祝你今天愉快!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM