Created
February 17, 2020 19:58
-
-
Save Doug-Moody/a9c2781331b657ef344edaeb2568fa29 to your computer and use it in GitHub Desktop.
Batch file that creates powershell file to handle username lookup requests. Displays MemberOf AD Groups quickly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
Title FindGroups | |
REM ####################################### | |
echo [CmdletBinding()]>%CD%\findgroups.ps1 | |
echo Param(>>%CD%\findgroups.ps1 | |
echo [Parameter(Mandatory=$True,Position=1)]>>%CD%\findgroups.ps1 | |
echo [string]$user>>%CD%\findgroups.ps1 | |
echo. >>%CD%\findgroups.ps1 | |
echo )>>%CD%\findgroups.ps1 | |
echo. >>%CD%\findgroups.ps1 | |
echo Get-ADPrincipalGroupMembership -identity $user | select name>>%CD%\findgroups.ps1 | |
echo write-host "Press any key to continue...">>%CD%\findgroups.ps1 | |
echo [void][System.Console]::ReadKey($true)>>%CD%\findgroups.ps1 | |
REM ################################### | |
:START | |
setlocal | |
cls | |
echo. | |
echo Enter the username to see the group membership. | |
set user= | |
set /p user=Enter Username: | |
powershell -File ".\findgroups.ps1" %user% | |
pause | |
goto :START |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment