Why wont this work?
Disable-ADAccount -Identity (user1, user2)
or this
$user = user1, user2
Disable-ADAccount -Identity $user
What would it look like if you wanted the script to output:
"Enter users to disable here: "
Technology Tips and News
Why wont this work?
Disable-ADAccount -Identity (user1, user2)
or this
$user = user1, user2
Disable-ADAccount -Identity $user
What would it look like if you wanted the script to output:
"Enter users to disable here: "
You need to go to school. Start here: https://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx?f=255&MSPPError=-2147217396
You also need to learn to type "help".
Start with "help help" and read everything very carefully.
That will answer all of your questions.
As jrv stated you should do some reading to learn the basics. Identity can take a string array (string[]), you are doing (user1, user 2) or $users = user1, user2, this is NOT an array.
To create an array in Powershell you use @() syntax.
What would it look like if you wanted the script to output:
"Enter users to disable here: "
Use Read-Host for that purpose.
The others have covered your other questions, so I'll leave it at that.
To clarify the mud. Read the help. Learn how to read the help. It is a basic requirement for using PowerShell.
-Identity <ADObject>
There is no mention of any string array in any help for "Identity"
To clarify the mud. Read the help. Learn how to read the help. It is a basic requirement for using PowerShell.
-Identity <ADObject>
There is no mention of any string array in any help for "Identity"