首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过PowerShell确定ADFS2.0配置类型

通过PowerShell确定ADFS2.0配置类型
EN

Stack Overflow用户
提问于 2013-12-13 21:46:53
回答 2查看 6.7K关注 0票数 1

ADFS2.0可以配置以下模式--独立模式、农场模式、SQLFarm模式。

作为诊断工作流的一部分,我需要检查这个。命令Get-ADFSConfiguration提供了大量的信息;但是,没有关于配置类型的显式属性。进一步研究后,类型StandlaloneFarmSQLFarm实际上指的是ADFS目录中的xml文件。

通过powershell确定ADFS2.0配置类型的最佳方法是什么?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 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。

我现在用的是..。

代码语言:javascript
复制
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';
}    
}
票数 1
EN

Stack Overflow用户

发布于 2014-01-06 21:06:43

更新:这是一个幼稚的解决方案。请跟随已批准的收信人。

代码语言:javascript
复制
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';
    }   
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20576567

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档