-
Notifications
You must be signed in to change notification settings - Fork 0
/
TSDHelper.ps1
81 lines (67 loc) · 4.43 KB
/
TSDHelper.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#TSD Helper
<#
───▄▄▄
─▄▀░▄░▀▄
─█░█▄▀░█
─█░▀▄▄▀█▄█▄▀
▄▄█▄▄▄▄███▀
#>
$ge = {
░██████╗░██╗░█████╗░███╗░░██╗████████╗ ███████╗░█████╗░░██████╗░██╗░░░░░███████╗
██╔════╝░██║██╔══██╗████╗░██║╚══██╔══╝ ██╔════╝██╔══██╗██╔════╝░██║░░░░░██╔════╝
██║░░██╗░██║███████║██╔██╗██║░░░██║░░░ █████╗░░███████║██║░░██╗░██║░░░░░█████╗░░
██║░░╚██╗██║██╔══██║██║╚████║░░░██║░░░ ██╔══╝░░██╔══██║██║░░╚██╗██║░░░░░██╔══╝░░
╚██████╔╝██║██║░░██║██║░╚███║░░░██║░░░ ███████╗██║░░██║╚██████╔╝███████╗███████╗
░╚═════╝░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝░░░╚═╝░░░ ╚══════╝╚═╝░░╚═╝░╚═════╝░╚══════╝╚══════╝
}
Write-Host $ge -ForegroundColor Red
Function getuser($who){
#Connect Azure
$UPN = Get-ADUser $env:USERNAME | select UserPrincipalName
Connect-AzureAD -AccountId $UPN.UserPrincipalName
#Prompt for user
$who = Read-Host "Search user with - User ID, First or Last Name, UPN or Email"
#User lookup
$FilterLogic = {name -like $who -or Surname -like $who -or UserPrincipalName -like $who -or SamAccountName -like $who -or GivenName -like $who} #DN filter CN @{l='CN';e={$_.DistinguishedName.split(',')[1].split('=')[1]}}
$userdata = Get-ADUser -Filter $FilterLogic -Properties * #| select Created, EmployeeID, CN, DisplayName, Title, EmailAddress, proxyAddresses, extensionAttribute1, DistinguishedName, Enabled, extensionAttribute3, LockedOut, lockoutTime, AccountExpirationDate
#Get Users Manager
$managertable = Get-ADUser $userdata.CN -Properties title, department, manager | Select-Object title, department, @{name='ManagerName';expression={(Get-ADUser -Identity $_.manager | Select-Object -ExpandProperty name)}},@{name='ManagerEmailAddress';expression={(Get-ADUser -Identity $_.manager -Properties emailaddress | Select-Object -ExpandProperty emailaddress)}} | Format-list
#Get Azure user data
$azuredata = Get-AzureADUser -ObjectId $userdata.UserPrincipalName
#Azure license assignment
$AzureLicense = Get-AzureADUserLicenseDetail -ObjectId $userdata.UserPrincipalName
#Azure Extention attribute
$azureextension = Get-AzureADUserExtension -ObjectId $userdata.UserPrincipalName
#Azure Manager
$AzureManager = Get-AzureADUserManager -ObjectId luke.encrapera@gianteagle.com
#Azure User Group Membership Report
$AzureMembership = Get-AzureADUserMembership -ObjectId luke.encrapera@gianteagle.com
#Azure User Devices
$AzureOwnedDevice = Get-AzureADUserOwnedDevice -ObjectId luke.encrapera@gianteagle.com
$AzureRegisteredDevice = Get-AzureADUserRegisteredDevice -ObjectId luke.encrapera@gianteagle.com
#Azure user MFA registration information for user
$AzureMFA = Get-AzureADUserRegisteredDevice -ObjectId
#Output
#Clear-Host
Write-Host $ge -ForegroundColor Red
#$ge
#$userdata.UserPrincipalName
#$userdata.DisplayName
Get-ADUser -Filter $FilterLogic -Properties * | select Created, EmployeeID, CN, DisplayName, Title, EmailAddress, proxyAddresses, extensionAttribute1, DistinguishedName, Enabled, extensionAttribute3, LockedOut, lockoutTime, AccountExpirationDate
$managertable
$azuredata
#$azureextension
#$AzureManager
#$AzureMembership
#$AzureOwnedDevice
#$AzureRegisteredDevice
Write-Host {
🆃🆂🅳 🅷🅴🅻🅿🅴🆁
To report bugs or request new features please email luke.encrapera@gianteagle.com
}
}
#Infinite loop
while($true){
getuser
Read-Host 'Enter to loop'
}