Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

List AD Group Membership

$
0
0

The following error message appears when I run this simple script: Out-File cannot bind argument to parameter 'Filepath' because it is null. I believe I need to enter $file in the out-file section, but am not sure where to place it.

Import-module ActiveDirectory

$date = get-date -Format "MMddyyyymm"

$file = "C:\Temp\Grp_mbrs_$date.csv"

Import-csv "c:\temp\grps.csv" | ForEach Object {

    $GName = $_.samaccountname

    $group = get-adgroup $Gname

    $group.name | out-file $memberlist -encoding unicode -append

}

THe grps.csv file contains the following:

samaccountname

grp1

grp2

grp3


mamadukes


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>