我需要将许多Azure AD组导出到一个csv文件中。它包括组的所有属性。我有成千上万的组,使用cmdlet时:authenticate mutation -
const Mutation = {
async authenticate(parent, { idToken }, ctx, info) {
let userToken = null
try {
userToken = await validateAndParseIdToken(idToken)
} catch (err) {
throw new Error(err.message)
}
const auth0id = userToken.sub.split('|')[1]
let user = await ctx.prisma.query.user({ where: { auth0id } }, info)
if (!user) {
user = createPrismaUser(ctx, userToken)
}
return user
},
属性get-azureadgroup
显示如下信息:
proxyaddresses
这是完整的cmdlet:
System.Collections.Generic.List`1[System.String]
如何确保Get-AzureADGroup -All $true | export-csv C:/exportmetest.csv
属性显示的是实际的SMTP地址?任何帮助或建议,我们将不胜感激。谢谢,祝你有美好的一天!
这是完整的cmdlet:
proxyaddresses
我需要将正确的Get-AzureADGroup -All $true | export-csv C:/exportmetest.csv
Get-AzureADGroup -All $true | export-csv C:/exportmetest.csv
信息输出到CSV文件中。
答案 0 :(得分:0)
欢迎使用堆栈溢出。下面是完成您的要求的一种方法。希望这可以帮助!干杯!
$GetAllAzureADGroups = Get-AzureADGroup -All $true
$ObjectProperties = @()
foreach ($GetAAzureADGroup in $GetAllAzureADGroups)
{
$ObjectProperties += New-Object PsObject -property @{
'DisplayName' = $GetAAzureADGroup.DisplayName
'MailNickName' = $GetAAzureADGroup.MailNickName
'Mail' = $GetAAzureADGroup.Mail
'MailEnabled' = $GetAAzureADGroup.MailEnabled
'ProxyAdresses' = [string]$GetAAzureADGroup.ProxyAddresses
'ObjectId' = $GetAAzureADGroup.ObjectId
'ObjectType' = $GetAAzureADGroup.ObjectType
'Description' = $GetAAzureADGroup.Description
'DeletionTimestamp' = $GetAAzureADGroup.DeletionTimestamp
'DirSyncEnabled' = $GetAAzureADGroup.DirSyncEnabled
'LastDirSyncTime' = $GetAAzureADGroup.LastDirSyncTime
'OnPremisesSecurityIdentifier' = $GetAAzureADGroup.OnPremisesSecurityIdentifier
'SecurityEnabled' = $GetAAzureADGroup.SecurityEnabled
'ProvisioningErrors' = [string]$GetAAzureADGroup.ProvisioningErrors
}
}
$ObjectProperties | Export-Csv .\exportmetest.csv -NoType
答案 1 :(得分:0)
如果涉及“ 数千 个Azure AD组”,则您可能需要正确使用管道以更好地利用内存(可能会提高性能)。为此,您应该不将结果分配给变量:
Get-AzureADGroup -All $True | ForEach-Object {
[PSCustomObject]@{
'DisplayName' = $_.DisplayName
'MailNickName' = $_.MailNickName
'Mail' = $_.Mail
...
}
} | Export-Csv .\exportmetest.csv -NoType