Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help. I am trying to get this PowerShell script to loop. Thank you. Hi this program will tell me if an user account is
Please help. I am trying to get this PowerShell script to loop. Thank you.
Hi this program will tell me if an user account is part of the Active Directory group. I am trying to get this to loop with a response of yes or no. But it is not looping and I'm not sure how to fix it. Thank you. #INITIALIZATION #Enter variable for user 1 $env:USERNAME #FUNCTION #This section contains the function to display member Get-ADUser -Identity khines #MAIN BODY #If the member is part of the AD group, return yes, if not, return no $env: USERNAME = $true #If ($env: username) () Write-Host "Yes" #else (env: username) write-Host "No" $env: USERNAME =$true Do "Starting loop $env:USERNAME" $env:USERNAME =$true $env: USERNAME } While ($env:USERNAME =khines) Hi this program will tell me if an user account is part of the Active Directory group. I am trying to get this to loop with a response of yes or no. But it is not looping and I'm not sure how to fix it. Thank you. #INITIALIZATION #Enter variable for user 1 $env:USERNAME #FUNCTION #This section contains the function to display member Get-ADUser -Identity khines #MAIN BODY #If the member is part of the AD group, return yes, if not, return no $env: USERNAME = $true #If ($env: username) () Write-Host "Yes" #else (env: username) write-Host "No" $env: USERNAME =$true Do "Starting loop $env:USERNAME" $env:USERNAME =$true $env: USERNAME } While ($env:USERNAME =khines)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started