ADFS2.0可以配置以下模式--独立模式、农场模式、SQLFarm模式。
作为诊断工作流的一部分,我需要检查这个。命令Get-ADFSConfiguration提供了大量的信息;但是,没有关于配置类型的显式属性。进一步研究后,类型Standlalone、Farm、SQLFarm实际上指的是ADFS目录中的xml文件。
通过powershell确定ADFS2.0配置类型的最佳方法是什么?
发布于 2014-11-08 12:39:29
这个假设是错误的。不要用这个代码。请参阅https://social.msdn.microsoft.com/Forums/sqlserver/en-US/7d5dee92-53ca-4cc5-bd02-d30833c4b94b/is-my-existing-adfs-a-standalone-or-a-single-server-farm-topology?forum=Geneva
您需要检查哪些服务登录帐户正在使用,如果不是网络服务,则它处于场模式,您可以检查artifactdbconnection。
我现在用的是..。
Function Get-ADFSConfigurationType
{
if ((Test-CommandExists "Get-ADFSConfiguration") -ne $true)
{
return 'Not Installed'
}
# get the localized form of 'NT AUTHORITY\NETWORK SERVICE'
$objSID = New-Object System.Security.Principal.SecurityIdentifier ("S-1-5-20") # NT AUTHORITY\NETWORK SERVICE
$objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
$networkserviceLocalizedName = $objUser.Value
$adfsServiceLogonName = (Get-WmiObject -ComputerName '.' Win32_Service | where {$_.Name -eq 'adfssrv'} | Select StartName).StartName
if ($adfsServiceLogonName -eq $networkserviceLocalizedName)
{
# ADFS is configured in standalone mode if it is running under NT AUTHORITY\NETWORK SERVICE
return 'Standalone';
}
if ($adfsServiceLogonName -eq 'LocalSystem')
{
# ADFS should not be run under Local System
# 'LocalSystem' is the same across all locales
return 'Error ADFSSRV Logon is LocalSystem';
}
try
{
$conf = Get-ADFSConfiguration;
}
catch
{
return 'Error Calling Get-ADFSConfiguration'
}
if ( $conf.ArtifactDbConnection -like "*\\.\pipe\*" )
{
# ADFS uses a Windows Internal Database, it's a Farm configuration
return 'Farm';
}
else
{
# ADFS is configured for SQLFarm
return 'SQLFarm';
}
}发布于 2014-01-06 21:06:43
更新:这是一个幼稚的解决方案。请跟随已批准的收信人。
Function Get-ADFSConfigurationType
{
$conf = Get-ADFSConfiguration;
if ( $conf.CertificateSharingContainer -eq $null )
{
# ADFS is configured in standalone mode.
return 'Standalone';
}
if ( $conf.ArtifactDbConnection -like "*\\.\pipe\*" )
{
# ADFS uses a Windows Internal Database, it's a Farm configuration
return 'Farm';
}
else
{
# ADFS is configured for SQLFarm
return 'SQLFarm';
}
}https://stackoverflow.com/questions/20576567
复制相似问题