none
powershell date paramater user input box RRS feed

  • Question

  • Hey all... I am trying to get my script that runs a report on a specific time frame to pop up an input window to input the date and time I need the report to run. I have it working just in the powershell command line, but want a window to pop up to input the data... any ideas?

    [string]$sDate=(Read-Host"Please enter start time"),

    [string]$fDate=(Read-Host"Please enter end time"),

    here is what im running for a parameter:

    Param(

       

    [int]$reportNumber=-2,


       

    [string]$sDate=(Read-Host"Please enter start time"),


       

    [string]$fDate=(Read-Host"Please enter end time"),


       

    [string]$rInstance='20'


    )

    Sunday, December 7, 2014 3:30 PM

Answers

  • Please check my article at codeproject for extensive journey of using all core Windows Forms, WPF, Selenium with Powershell for tasks which often require various option prompts.

    http://www.codeproject.com/Articles/799161/Dealing-with-Powershell-Inputs-via-Basic-Windows-F

    You find there over 40 common Windows form patterns  ( prompts, grids, check/radio boxes, progress bars of many forms, tree views, item lists, passwords, tool tips, system tray widgets, browser controls, examples of using p/invoke, hosting custom controls, dealing with selenium webdriver, dealing with selenium-unfriendly file upload dialogs etc. ) all covered there - working code for every example is provided, and the code is hosted on github.

    https://github.com/sergueik/powershell_ui_samples
    Sunday, January 18, 2015 11:27 PM

All replies

  • Search for powershell popups.

    You can also use the VB net helper.

    add-type -AssemblyName Microsoft.VisualBasic
    $var=[Microsoft.VisualBasic.Interaction]::InputBox('Enter something now')
    $var


    ¯\_(ツ)_/¯

    • Proposed as answer by Luigi BrunoMVP Sunday, December 7, 2014 5:05 PM
    Sunday, December 7, 2014 4:11 PM
  • Please check my article at codeproject for extensive journey of using all core Windows Forms, WPF, Selenium with Powershell for tasks which often require various option prompts.

    http://www.codeproject.com/Articles/799161/Dealing-with-Powershell-Inputs-via-Basic-Windows-F

    You find there over 40 common Windows form patterns  ( prompts, grids, check/radio boxes, progress bars of many forms, tree views, item lists, passwords, tool tips, system tray widgets, browser controls, examples of using p/invoke, hosting custom controls, dealing with selenium webdriver, dealing with selenium-unfriendly file upload dialogs etc. ) all covered there - working code for every example is provided, and the code is hosted on github.

    https://github.com/sergueik/powershell_ui_samples
    Sunday, January 18, 2015 11:27 PM