none
Need power Shell script to replace file path and port no automatically.

    Question

  • Set-ExecutionPolicy Unrestricted
    Import-Module ServerManager
    Add-WindowsFeature Web-Scripting-Tools
    Import-Module WebAdministration
    cd iis:\\
    new-item iis:\\sites\eHelplineauto1 -bindings @{protocol="http";bindinginformation="*:6789:localhost"} -physicalpath C:\Hostsite -ApplicationPool "ASP.NET v4.0 Classic"

    in above script before running i would like to give 2 text boxes for replacing the port and file path automatically

    ex

    i want to change to port 80 i will give input as 80 in one text box

    and file path as A:\Hostsite no i will click on ok button

    then in my ps1 file script should change as

    Set-ExecutionPolicy Unrestricted
    Import-Module ServerManager
    Add-WindowsFeature Web-Scripting-Tools
    Import-Module WebAdministration
    cd iis:\\
    new-item iis:\\sites\eHelplineauto1 -bindings @{protocol="http";bindinginformation="*:80:localhost"} -physicalpath A:\Hostsite -ApplicationPool "ASP.NET v4.0 Classic"

      

    Friday, May 18, 2018 10:21 AM

All replies

  • Powershell is a text shell ...  there are no text boxes with ok buttons.  ;-) Instead you can use Read-Host. It does actually the same.

    Best regards,

    (79,108,97,102|%{[char]$_})-join''


    • Edited by BOfH_666 Friday, May 18, 2018 11:24 AM
    • Proposed as answer by jrvModerator Friday, May 18, 2018 12:04 PM
    Friday, May 18, 2018 11:07 AM