Question: 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. Please help. I am trying to get this PowerShell script to loop.

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!