active directory - Powershell - AD Report create a new column with a generic value -
i use script query ad , extract user data.
get-aduser -filter * -properties *| select-object -property samaccountname,cn,co,extensionattribute10,extensionattribute11,extensionattribute12,emailaddress,whencreated,enabled,lastlogondate,accountexpirationdate, @{name='parentou'; expression={[regex]::match($_.distinguishedname,'(?<=ou=.+?ou=).+?(?=,(ou|dc)=)').value}},distinguishedname,description | sort-object -property name <#| where-object {$_.distinguishedname -like "*regular*"-or $_.distinguishedname -like "*remote*" -or $_.distinguishedname -like "*shopfloor*" -or $_.distinguishedname -like "*brp admin*" }#> | export-csv -append -delimiter ";" -path $path i take result of "enable" column, true or false, , create new column call "suspended" if result of enable true value put in "suspended" no. if result false, value put in "suspended should "yes"
can me ?
just create new calculated property based on value of enabled property.
... | select-object ... ,enabled,@{n='suspended';e={if($_.enabled){'no'}else{'yes'}}},...
Comments
Post a Comment