process - Opening AD from vb.net with different credentials -
i have found following code
dim p new processstartinfo { .filename = "c:\windows\system32\dsa.msc", .arguments = "/savecred /user:domain\username" } ' start process process.start(p)
i want able pass following cmd prompts username
c:\windows\system32\runas.exe /savecred /user:domain\username "c:\windows\system32\mmc.exe c:\windows\system32\dsa.msc"
which works opening app not pass username or prompt password, cant figure out how forse different cred along arguments.
ideas ??
ok figured out - here code used
function converttosecurestring(byval str string) dim password new securestring each c char in str.tochararray password.appendchar(c) next return password end function private sub button2_click(sender object, e eventargs) handles button2.click dim passwordstring string passwordstring = "..........." dim password securestring = converttosecurestring(passwordstring) ' new processstartinfo created dim p new processstartinfo ' specify location of binary p.filename = "mmc.exe" p.workingdirectory = "c:\windows\system32\" ' use these arguments process p.arguments = "dsa.msc" p.domain = "........" p.username = "......." p.password = password p.useshellexecute = false ' start process process.start(p) end sub
Comments
Post a Comment