MelittaChickadee
asked on
Need Help With Powershell Script
Hello. I am looking for some assistance creating a Powershell Script to do the following.
1. List all users of a specific group in active directory and write to an XLS
2. Then I want to use the users in the XLS and get the email address's dumped to an XLS.
This is what I have found to start with, however it doesn't return any thing within PS.
$root=([ADSI]"").distingui shedName
$Group = [ADSI]("LDAP://CN=Domain Admins, CN=Users,"+ $root)
$Group.member
Any Powershell Guru's here ?
Thanks
1. List all users of a specific group in active directory and write to an XLS
2. Then I want to use the users in the XLS and get the email address's dumped to an XLS.
This is what I have found to start with, however it doesn't return any thing within PS.
$root=([ADSI]"").distingui
$Group = [ADSI]("LDAP://CN=Domain Admins, CN=Users,"+ $root)
$Group.member
Any Powershell Guru's here ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Welcome back BSonPosh :) I thought we'd lost you for a while.
Chris
I am here all the time :)
I just have been focusing on the Powershell questions.
You on the other hand have been quite busy :)
I just have been focusing on the Powershell questions.
You on the other hand have been quite busy :)
ASKER
Hello Chris and BSonPosh,
I appreciate the help. When I run the script as is, I receive the folllowing:
Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
At line:1 char:22
+ $Results | Export-CSV <<<< -Path "outputfile.csv"
I would imagine I need to put some variables into this ?
Again, appreciate your help.
I appreciate the help. When I run the script as is, I receive the folllowing:
Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
At line:1 char:22
+ $Results | Export-CSV <<<< -Path "outputfile.csv"
I would imagine I need to put some variables into this ?
Again, appreciate your help.
That error implies that $results is NULL. Did you try my Quest example?
ASKER
Hello BSonPosh,
Yes your recommendation to use Quest cmdlets work great! I will give you the Accepted Solution. On a side note, how tough is it to do the following in PS using the Quest cmdlets ?
1. Search AD For any user with *whatever.com email address, export to csv.
2. Then do a bulk edit to change with *.whomever.com email address.
-or-
1. Search AD for any user with *whatever.com email address then simply do a bulk edit to give them a new primary SMTP address of *.whomever.com ?
THoughts ? Again..appreciate your help!
Thanks,
Brian
Yes your recommendation to use Quest cmdlets work great! I will give you the Accepted Solution. On a side note, how tough is it to do the following in PS using the Quest cmdlets ?
1. Search AD For any user with *whatever.com email address, export to csv.
2. Then do a bulk edit to change with *.whomever.com email address.
-or-
1. Search AD for any user with *whatever.com email address then simply do a bulk edit to give them a new primary SMTP address of *.whomever.com ?
THoughts ? Again..appreciate your help!
Thanks,
Brian
It would not be that complicated at all. Something like this [1]
[1] means I didn't test it
btw... I am starting a weekly series on www.turbochargead.org that will cover these cmdlets
[1] means I didn't test it
btw... I am starting a weekly series on www.turbochargead.org that will cover these cmdlets
$users = Get-Qaduser -ldapfilter "mail=*whatever.com"
foreach($user in $users)
{
$user | set-qaduser -objectattributes @{mail="$($user.name)@whomever.com"} -whatif
}
ASKER
I am going to test out of prod , and I will let you know. Anyway I could get the results written to a csv?
Thanks,
Thanks,
you can almost always use export-csv.
Get-Qaduser -ldapfilter "mail=*whatever.com" | export-csv myfile.csv
Get-Qaduser -ldapfilter "mail=*whatever.com" | export-csv myfile.csv
ASKER
BSonPosh,
Ran the following :
Qaduser -ldapfilter "mail=*whatever.com"
foreach($user in $users)
{
$user | set-qaduser -objectattributes @{mail="$($user.name)@whom ever.com"} -whatif
}
Nothing happens...just returns me to a >>
Help ?
Ran the following :
Qaduser -ldapfilter "mail=*whatever.com"
foreach($user in $users)
{
$user | set-qaduser -objectattributes @{mail="$($user.name)@whom
}
Nothing happens...just returns me to a >>
Help ?
I would approach it from the other way. Searching AD for the members allows us to return any property we might need in a single search.
HTH
Chris
Open in new window