Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

=+and non-compete agreements in three to five different countries.

Answered: 1 week ago