ฉันค่อนข้างใหม่ที่จะต้อง powershell. ไม่แน่ใจว่าผมทำอะไรผิดปกติที่นี่ พยายามที่จะส่งออกทั้งหมดขหนึ่งของผู้ใช้โฆษณากลุ่มเพื่อเป็นแฟ้ม csv. ฉันรู้ว่ามันค่อนข้างยากที่รหัสแต่ก็แค่พยายามที่จะทำบางอย่างง่ายๆ
Import-Module ActiveDirectory
$UserName = “pball“
$ReportPath = “C:\Input\EricsStuff\userADgroups.csv“
Get-ADPrincipalGroupMembership $Username | select name, groupcategory, groupscope | export-CSV C:\Input\EricsStuff\userADgroups.csv
# Export to :
# C:\Input\EricsStuff\userADgroups.csv
โดยเฉพาะข้อผิดพลาดคือ:
Get-ADPrincipalGroupMembership : An unspecified error has occurred
At C:\Input\EricsStuff\ExportUserGroups.ps1:7 char:1
+ Get-ADPrincipalGroupMembership $Username | select name, groupcategory ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (pball:ADPrincipal) [Get-ADPrincipalGroupMembership], ADException
+ FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.GetADPrincipalGroupMemb
ership