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" 

Comments

  1. Powershell - Missing = Operator After Key In Hash Literal - >>>>> Download Now

    >>>>> 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

    ReplyDelete

Post a Comment

Popular posts from this blog

c# - must be a non-abstract type with a public parameterless constructor in redis -

c# - ReportViewer control - axd url -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -