martes, 5 de diciembre de 2017

WINDOWS. PS. Search duplicate member in AD Groups

It search in groups members equals or similars and return the %

https://gallery.technet.microsoft.com/PowerShell-to-Find-Stale-441759fc

Run script:
long time later ....



The result is at "GroupMembershipComparison.csv". We tranform the data at columns

 
Now can view...

Check at Windows 2012 R2
by GoN | Published: December 5, 2017 | Last Updated:

jueves, 16 de noviembre de 2017

WINDOWS. PS. Mail by default

[ ] Introduction

I have a lot of user at my Exchange, all users have more of one email, for O365 project I need assign one specific default email.

I prepared one list with a login name and the new default email account.


[ ] The script

**********************************

# Import AD Module
#Import-Module ActiveDirectory

#Si queremos hacer un BAckup antes:
#Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,PrimarySmtpAddress > Backup

#Log
$LogFile = "C:\scripts\O365\EmailDefault\logUpdates.txt"

write-Host 'Starting to update AD Attributes.......' -NoNewline -ForegroundColor Yellow
write-Host "`r`n"

# Import CSV into variable $LIST_users

#fICHERO DE USUARIOS A ACTUALIZAR
$LIST_users = Import-Csv C:\scripts\O365\EmailDefault\UserList.TXT -delimiter ";"
# Loop through CSV and update users if the exist in CVS file

$LIST_users|Foreach{


Write $_.Login
Write-output "`n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++`r`n" >> $LogFile
        Write-output $_.Login | out-file -filepath $LogFile -append
Write-output "`n====================================================================`r`n" >> $LogFile
Set-Mailbox $($_.Login) -Primarysmtpaddress $($_.DefaultAddress) -confirm:$false -Emailaddresspolicyenable $False 2>> $LogFile


}

Write-Host 'done!' -ForegroundColor Green

*********************************

[ ] The Log

For check I can verify my log ($LogFile = "C:\scripts\O365\EmailDefault\logUpdates.txt") with the results.



REF: https://technet.microsoft.com/es-es/library/hh847746.aspx

Check at Exhange 2007
by GoN | Published: November 16, 2017 | Last Updated:

viernes, 3 de noviembre de 2017

WINDOWS. PS. Easy uptade user attributes.

I explain a simple and quicly script to update user AD attributes. At this example update 3 atributes from AD users

[ ] Source txt tributes:

LOCATION_NAME , COMPANY_NAME, LOCATION_ADDRESS


Source user data: C:\tmp\Upgradeusersdata\users.csv

[ ] Destination AD atributes

Office, Company, StreetAddress




[ ] Script:


/***********************************************************************/
# Import AD Module
Import-Module ActiveDirectory

$Delimiter = ";"

write-Host 'Starting to update AD Attributes.......' -NoNewline -ForegroundColor Yellow
# Import CSV into variable $LIST_users

$LIST_users = Import-Csv C:\tmp\Upgradeusersdata\users.csv $Delimiter
# Loop through CSV and update users if the exist in CVS file

$LIST_users|Foreach{

Set-ADUSer -Identity $_.Login -Office $_.LOCATION_NAME -Company $_.COMPANY_NAME -StreetAddress $_.LOCATION_ADDRESS
Write $_.Login

}

Write-Host 'done!' -ForegroundColor Green


/***********************************************************************/

The "-Identity" will be our index.

Check at Windows 2012 R2
by GoN | Published: November 3, 2017 | Last Updated: