gpt4 book ai didi

powershell - 通过 Powershell 设置 AzureAD 的 StrongAuthenticationUserDetails PhoneNumber?

转载 作者:行者123 更新时间:2023-12-01 04:47:16 26 4
gpt4 key购买 nike

这个标题确实很流畅。

在设置计算机以与 Azure Active Directory 一起使用时,我们会让 IT 人员进行初始设置和配置。这包括首次登录和加入 Azure Active Directory。登录时,它会强制您选择验证方法。为了方便起见,我们会使用桌面电话或手机。

我们是时候更新第二个因素的电话号码了。我知道一种通过 Azure AD Web UI 手动执行此操作的方法,但我正在寻找一种脚本化方法来在 PowerShell 中设置该数字。

以下是我如何通过 PowerShell 检索号码。

Get-msoluser -UserPrincipalName "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c09010d05002c09010d05000d08081e091f1f420f0301" rel="noreferrer noopener nofollow">[email protected]</a>" | Select-Object -ExpandProperty StrongAuthenticationUserDetails

该代码返回此信息:

ExtensionData                     : System.Runtime.Serialization.ExtensionDataObject
AlternativePhoneNumber :
Email :
OldPin :
PhoneNumber : +1 5554445555
Pin :

但是,似乎没有类似的选项用于设置 StrongAuthenticationUserDetails。

我所有的搜索都只是找到如何批量启用两步身份验证,这不是我想要做的。我想保留 StrongAuthentication 不变,而仅更新电话号码。

最佳答案

正如我在评论中所说,powershell 似乎具有只读访问权限。

甚至在 Azure feedback 上也有开票。 .

有计划这样做,但没有预计到达时间。我的猜测是,如果您只想使用 powershell,则必须等待。

作为解决方法,您可以使用 powershell watir for .NET WatinWatin recorder通过 Internet Explorer 使其自动化。因为我没有测试 Azure;我无法为您创建可行的代码。

使用Watin和powershell - 你可以检查:https://cmille19.wordpress.com/2009/09/01/internet-explorer-automation-with-watin/

以下文本和代码(我想在此处备份)取自上述页面(所有内容均归作者所有):

Next click the record button and click the HTML element you want to automate. Then stop the WatIN recorder and click copy code to clipboard icon. This will produce some C# code that just needs to be translated into PowerShell:

// Windows
WatiN.Core.IE window = new WatiN.Core.IE();

// Frames
Frame frame_sd_scoreboard = window.Frame(Find.ByName("sd") && Find.ByName("scoreboard"));

// Model
Element __imgBtn0_button = frame_sd_scoreboard.Element(Find.ByName("imgBtn0_button"));

// Code
__imgBtn0_button.Click();
window.Dispose();

So, I now know the name of the button and that it is 3 frames deep. A little WatIN object exploration later, I came up with the follow script, which clicks a button every 50 mintues.

#Requires -version 2.0
#powershell.exe -STA

[Reflection.Assembly]::LoadFrom( "$ProfileDirLibrariesWatiN.Core.dll" ) | out-null
$ie = new-object WatiN.Core.IE("https://sd.acme.com/CAisd/pdmweb.exe")
$scoreboard = $ie.frames | foreach {$_.frames } | where {$_.name –eq ‘sd’} | foreach {$_.frames } | where {$_.name –eq ‘scoreboard’}
$button = $scoreboard.Element("imgBtn0_button")

while ($true)
{
$button.Click()
#Sleep for 50 minutes
[System.Threading.Thread]::Sleep(3000000)
}

关于powershell - 通过 Powershell 设置 AzureAD 的 StrongAuthenticationUserDetails PhoneNumber?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45718575/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com