how to allow manual or automated choice in powershell? -


I am writing a script where I want users to enter the manual server or they can give a list to the server C: \ temp \ server.txt.

The only problem is that I do not know how I do this - that is, I know that I can give a signal to the user to enter below - but I would like them to have a button option or For some things - maybe they can type in a manual server or path and then tell the statistics of PowerShell which is

Any idea how do I go to this?

  Read-Host "Do you want to enter a list of manual computers or computers?"   

Thanks,

promptfront Look at the method. There are many resources on the internet, like @ by the bait.

First you have to show a prompt for the choice (where you call PromptForChoice ) and then process the user request (see the switch on the above page).

Actually there may be some sample code:

  $ option = [management. Automation.Host Change description []] (`(new object management .automation.host .special description" & amp; list "," list of servers "), (new object management.automation.host.choicediscriptation" and one "," a server ")); $ Answer = $ host.ui.PromptForChoice ("MicroTools", "Run MicroTools?", $ Option, 0) If ($ answer -eq 0) {# Get list of servers} and {# get a server} < / Code>   

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -