12.22.2016

Powershell script to query AD, Novell, and Azure

Powershell script to query AD, Novell, and Azure

<#
Written by:
Date: 12-16-2016
Requires Azure AD Powershell and Active Directory Lightweight role on server to run

#>


Import-Module MSOnline
$Cred = Get-Credential
$username = Read-Host -Prompt 'Type in the username:?'

#Query AD

csvde -f searchAD.txt -s ipOfServer -a "CN=ldapuser,CN=Users,DC=domain,DC=edu" 'password' -p subtree -l "sAMAccountName,cn,distinguedName" -r "(&(objectClass=User)(sAMAccountName=$username))"          
Import-Csv .\searchAD.txt | Out-GridView -Title "Active Directory"

#Query Novell
csvde -f searchNovell.txt -s ipOfServer -r "(cn=$username)" -a "cn=NetLdapProxy,ou=SERVERS,o=XYZ" "password"
Import-Csv .\searchNovell.txt | Out-GridView -Title "Novell eDirectory"

#Query Azure AD
Connect-MSOLService –Credential $Cred
Get-MsolUser -UserPrincipalName $username@domain.edu | Out-GridView -Title "Azure Active Directory"

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.