Run comand to list of users?

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: "

September 10th, 2015 4:21am

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.

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 4:26am

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.

September 10th, 2015 7:59am

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.

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 8:08am

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"

September 10th, 2015 9:18am

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"

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 9:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics