SOLVED Checkboxes in PowerShell command line?

Ian

Administrator
Joined
Oct 27, 2013
Messages
1,735
Reaction score
630
I'm considering using a command line version of a script, rather than creating a GUI, as it'll be a little bit easier for me.

I have a CSV imported, with a list of names, URLs, username and software type - this is in a hash table called "$domains".

I'd like to have a menu where I can check some of the domain names, so that I can perform an action in the next step.

For example, the current CSV output looks like this:

Code:
Site Name       URL          Username Type     
---------       ---          -------- ----     
Test FTP Site   192.168.1.1  testftp  v1
Test FTP Site 2 192.168.1.1  testftp2 v1
Test FTP Site 3 192.168.1.1  testftp3 v2

I'd ideally like this list to display with a check box so that I can mark domains for actions, so that it would look a little like this:

Code:
    Site Name       URL          Username Type     
--- ---------       ---          -------- ----     
[X] Test FTP Site   192.168.1.1  testftp  v1
[X] Test FTP Site 2 192.168.1.1  testftp2 v1
[ ] Test FTP Site 3 192.168.1.1  testftp3 v2

i.e. I can scroll down the list with the arrow keys and press space to check certain domains.

Is that something that is possible to do via the command line? I've had a good search, but I can only find GUI examples.
 

Ian

Administrator
Joined
Oct 27, 2013
Messages
1,735
Reaction score
630
It looks like using a GUI is actually the easiest bit. This one line does everything (import csv, filter selection):

Code:
$domains = Import-Csv "domains.csv" | Out-GridView -Title "Select Domain(s) to Upload to" -passthru
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top