powershell Active Directory读取受信任的域

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell Active Directory读取受信任的域相关的知识,希望对你有一定的参考价值。

#--------------------------------------------------------------------------------
# Reading Trusted Domains
#--------------------------------------------------------------------------------
function getTrustedDomains
{
	#Reading trusted Active Directories
	$ActiveDirectories = @()
	$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
	$objSearcher.PageSize = 1
	$objSearcher.Filter = "(objectclass=trustedDomain)"
	$objSearcher.SearchScope = "Subtree"
	$trustedActiveDirectorys = $objSearcher.FindAll()
	
	foreach ($Directory in $trustedActiveDirectorys.path)
	{
		$DirectoryPath = ($Directory.Split(',')[0]).substring('10')
		#write-host $DirectoryPath
		$ActiveDirectories += $DirectoryPath
		$combobox1.Items.Add($DirectoryPath)
	}
	
	$ActiveDirectories += (getDomain)[0]
	
	WriteLogFile "function: getTrustedDomains - $ActiveDirectories"
	return $ActiveDirectories
}

以上是关于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获取计算机的上次登录时间