powershell - Missing '=' operator after key in hash literal -
i'm trying create powershell script list groups in active directory created in last 21 days. works fine group can managed user or security group. , display 'display name' of user/security group.
what have created far:
$when = ((get-date).adddays(-21)).date get-adgroup -searchbase "ou=groups,ou=bel,ou=eu,dc=domain,dc=net" -filter {whencreated -ge $when} -properties * | select whencreated, cn, displayname,groupscope, groupcategory, description, info,@{label='managedby';expression={ if(get-adobject $_.managedby -filter 'objectclass -eq "user"') {(get-aduser $_.manager -properties displayname).displayname} else{(get-adgroup $_.managedby -properties cn).cn} } | export-csv "new groups -21 days.csv" -notypeinformation -delimiter ";" -encoding utf8; start "new groups -21 days.csv"
it says: missing '=' operator after key in hash literal , can't seem figure out needs changed. thank help.
you missing underscores variables $.managedby , $.manager. both should $_.managedby
$_.manager
, closing brace missing.
$when = ((get-date).adddays(-21)) get-adgroup -filter {whencreated -ge $when} -properties * | select whencreated, cn, displayname, groupscope, groupcategory, description, info, @{ label='managedby'; expression={ if(get-adobject $_.managedby -filter 'objectclass -eq "user"') { (get-aduser $_.manager -properties displayname).displayname} else{ (get-adgroup $_.managedby -properties cn).cn } } } | export-csv "new groups -21 days.csv" -notypeinformation -delimiter ";" -encoding utf8; start "new groups -21 days.csv"
Powershell - Missing = Operator After Key In Hash Literal - >>>>> Download Now
ReplyDelete>>>>> Download Full
Powershell - Missing = Operator After Key In Hash Literal - >>>>> Download LINK
>>>>> Download Now
Powershell - Missing = Operator After Key In Hash Literal - >>>>> Download Full
>>>>> Download LINK 8F