Imports System.Security Imports System.ComponentModel Module Module1 Sub Main() Dim username As String = "MyUser" Dim password As SecureString = ConvertToSecureString("MyPassword") Dim domain As String = "MyDomain" Dim filename As String = "c:\windows\notepad.exe" Try System.Diagnostics.Process.Start(filename, username, password, domain) Catch ex As Win32Exception System.Windows.Forms.MessageBox.Show("Something went wrong!", "Error") End Try End Sub Function ConvertToSecureString(ByVal str As String) Dim password As New SecureString For Each c As Char In str.ToCharArray password.AppendChar(c) Next Return password End Function End Module
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.