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

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

How to handle command-line arguments in PowerShell

You are reinventing the wheel. Normal PowerShell scripts have parameters starting with -, like script.ps1 -server http://devserver Then you handle them in param section in the beginning of the file. You can also assign default values to your params, read them from console if not available or stop script execution: Inside the script you can simply since all parameters … Read more

Change directory in PowerShell

Unlike the CMD.EXE CHDIR or CD command, the PowerShell Set-Location cmdlet will change drive and directory, both. Get-Help Set-Location -Full will get you more detailed information on Set-Location, but the basic usage would be By default in PowerShell, CD and CHDIR are alias for Set-Location. (Asad reminded me in the comments that if the path contains spaces, it must be enclosed in quotes.)

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