Prompt for user input in PowerShell

Read-Host is a simple option for getting string input from a user. To hide passwords you can use: To convert the password to plain text: As for the type returned by $host.UI.Prompt(), if you run the code at the link posted in @Christian’s comment, you can find out the return type by piping it to Get-Member (for example, $results | … Read more

How to run an EXE file in PowerShell with parameters with spaces and quotes

How do you run the following command in PowerShell? C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql=”Data Source=mysource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;” -dest:dbfullsql=”Data Source=.\mydestsource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;”,computername=10.10.10.10,username=administrator,password=adminpass”

How to run an EXE file in PowerShell with parameters with spaces and quotes

How do you run the following command in PowerShell? C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe -verb:sync -source:dbfullsql=”Data Source=mysource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;” -dest:dbfullsql=”Data Source=.\mydestsource;Integrated Security=false;User ID=sa;Pwd=sapass!;Database=mydb;”,computername=10.10.10.10,username=administrator,password=adminpass”

Downloading a file with PowerShell

Invoke-WebRequest comes with a parameter to store its result in a file: -OutFile If you need authorization before you can send a request like this: To determine the layout of the form where the login happens, you can use Invoke-WebRequests return object. It’ll collect information about forms and fields on the HTML (might be Windows only). Mileage … Read more

How to split string by string in Powershell

The -split operator uses the string to split, instead of a chararray like Split(): If you want to use the Split() method with a string, you need the $seperator to be a stringarray with one element, and also specify a stringsplitoptions value. You can see this by checking its definition: EDIT: As @RomanKuzmin pointed out, -split splits using regex-patterns by default. So be aware … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)