powershell Active Directory获取当前的域功能
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell Active Directory获取当前的域功能相关的知识,希望对你有一定的参考价值。
function getDomain
{
#Reading current Active Directory
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.PageSize = 1
$objSearcher.Filter = "(objectclass=Domain)"
$objSearcher.SearchScope = "Subtree"
$currentActiveDirectory = $objSearcher.FindAll()
$LocalDomain = ($currentActiveDirectory.path).replace(",DC=", ".").replace("LDAP://DC=", "")
$path = $currentActiveDirectory.path
WriteLogFile "function: getDomain - Scriptrunning Domain is $LocalDomain"
return $LocalDomain, $path
}
以上是关于powershell Active Directory获取当前的域功能的主要内容,如果未能解决你的问题,请参考以下文章
powershell PowerShell:列出Active Directory子网
powershell PowerShell:备份Active Directory组策略#PowerShell#ActiveDirecoty
powershell 使用powershell添加Active Directory组成员
powershell PowerShell:Active Directory中的操作系统计数
powershell PowerShell:按收件人类型交换Active Directory查询
powershell PowerShell:从Active Directory获取计算机的上次登录时间