有没有办法使用PowerShell将Windows 10计算机加入Azure广告?

有没有办法使用PowerShell将Windows 10计算机加入Azure广告?,azure,powershell,azure-active-directory,windows-10,Azure,Powershell,Azure Active Directory,Windows 10,我想使用PowerShell脚本将组织中的计算机加入Azure AD 我尝试使用newazureaddevice命令 但在这个例子中: New-AzureADDevice -AccountEnabled $true -DisplayName "My new device" -AlternativeSecurityIds $altsecid -DeviceId $guid -DeviceOSType "OS/2" -DeviceOSVersion "

我想使用PowerShell脚本将组织中的计算机加入Azure AD

我尝试使用
newazureaddevice
命令

但在这个例子中:

New-AzureADDevice -AccountEnabled $true -DisplayName "My new device" -AlternativeSecurityIds $altsecid -DeviceId $guid -DeviceOSType "OS/2" -DeviceOSVersion "9.3"

有人能解释一下参数
AlternativeSecurityId
从何而来吗?

AlternativeSecurityId由三个元素组成,设备只需要两个元素

参考:

  • 密钥本身是所描述的类型

    X509:[指纹]+[publickeyhash]

  • 类型决定密钥的用途(例如Bitlocker、Windows Hello、Recoverykeys)

    $key=[System.Text.Encoding]::Unicode.GetBytes(“X509:”)
    $altsecids=新对象-类型名称PSObject-属性@{
    #“IdentityProvider”=“null”
    “Key”=$Key
    '类型'=“2”}
    新AzureAddDevice-AccountEnabled$true-DisplayName'-DeviceOSType'OS/2'-DeviceOSVersion'9.3'-AlternativeSecurityID$AltsecID-DeviceId(新Guid)
    
这主要用于内部使用,据我所知,您将无法达到您的要求

目前,没有能够自动加入AAD的powershell脚本/commandlet

已经存在一个相同的

另一种选择将能够利用:

  • ,及

看一看:引用这篇博客文章“AlternativeSecurityID包含具有特定方案格式的证书指纹(即“X509::”+指纹)。这是Azure AD在设备在认证时显示证书时查找设备对象的方式。我想这是您在创建设备中提供的“密钥”。
AlternativeSecurityIds        : {class AlternativeSecurityId {
                                  IdentityProvider:
                                  Key: System.Byte[]
                                  Type: 2
                                }
                                }
     $key = [System.Text.Encoding]::Unicode.GetBytes("X509:<SHA1-TP-PUBKEY><Thumbprint>")
     $altsecids = New-Object -TypeName PSObject -Property @{

     #'IdentityProvider' = 'null'
     'Key' = $key
     'Type' = "2" }




     New-AzureADDevice -AccountEnabled $true -DisplayName '<NAME>' -DeviceOSType 'OS/2' -DeviceOSVersion '9.3' -AlternativeSecurityIds $altsecids -DeviceId (New-Guid)