How to use environment variables in Powershell?

Sometimes you need to use an environment variable (eg. username, userprofile, computername, …) in Powershell. The location where environment variables are stored is “env:”. This behaves similar to a hard or flash drive. You can list its content or...

How to read and use the contents of a website from Powershell?

First we need to create a xmlhttp object, similar to what you would do in JavaScript $objXmlHttp = New-Object -ComObject MSXML2.ServerXMLHTTP Use the open method to specify the url, optional username and password. The third parameter (optional) is a boolean indicator...

How to connect to / read from / write to SQL Server from Powershell?

First create the connection object, set the connection string and open the connection: $objSqlConnection = New-Object System.Data.SqlClient.SqlConnection $objSqlConnection.ConnectionString = “Server=YourSqlServer; Database=YourDataBase; User Id=YourUsername;...