Posted on: 7/22/2013 10:46:14 AM | Views : 264

Try ' Prepare the credentials that will be used when connecting ' to the server. More info on the user to use on the notes ' below this code snippet. Dim runasUsername As String = "domain\user" Dim runasPassword As String = "test" Dim ssRunasPassword As New SecureString() For Each x As Char In runasPassword ssRunasPassword.AppendChar(x) Next Dim credentials As New PSCredential(runasUsername, ssRunasPassword) ' Prepare the connection Dim connInfo = New WSManConnectionInfo(New Uri("http://ServerName/PowerShell"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", credentials) connInfo.AuthenticationMechanism = AuthenticationMechanism.Basic ' Create the runspace where th ...

Go to the complete details ...