Another PS script im stuck with!
I have created these from scratch and cannot figure out how to either;
1. combine the scripts together
2. just combine the output into 1 CSV
I have created these from scratch and cannot figure out how to either;
1. combine the scripts together
2. just combine the output into 1 CSV
Code:
#Based on OU - gets username and groups they are in
Get-ADUser -LDAPFilter "(name=*)" -SearchScope Subtree `
-SearchBase "OU=User Accounts,DC=Domain,DC=local" | %{
$user = $_
$user | Get-ADPrincipalGroupMembership |
Select @{N="User";E={$user.sAMAccountName}},@{N="Group";E={$_.Name}}
}| Select User,Group | export-csv
#Based on OU - gets group descriptions (copy the description into the above extract to have complete report (dirty work around))
Get-ADUser -LDAPFilter "(name=*)" -SearchScope Subtree `
-SearchBase "OU=User Accounts,DC=domain,DC=local" | %{
$user = $_
$user | Get-ADPrincipalGroupMembership |
Get-ADGroup -Properties * | select description} | export-csv