Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Powershell script help needed

$
0
0

Hello,

I am new to powershell and I am trying to get the script below to work the following way. I want to have the usernames in a text file, one for each line and I want to pipe the output to individual .csv files...one for each user. This script works as is by entering the username but I need to do this with over 1000 files so copy and past is out, any help would be greatly appreciated.

param([String] $UserName = "username")

Import-Module ActiveDirectory
$FileName = (".\" + $UserName + ".csv")

$User = GET-ADUSER –Identity $UserName –Properties MemberOf
$AdGroups = ($User.MemberOf | Get-AdGroup -Properties SamAccountName,Description,info,MemberOf)
$script:AllAdGroups = $AdGroups

function GetGroups ($memberOf)
{
$groups = ($memberOf | Get-AdGroup -Properties SamAccountName,Description,info,MemberOf)
$script:AllAdGroups += $groups
$groups |...


Viewing all articles
Browse latest Browse all 15370

Trending Articles



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