ASP.net and Psexec
<code>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim de As new DirectoryEntry("LDAP://MYOUPath")
Dim ds As DirectorySearcher = new system.directoryservices.directorySearcher(de)
'ds.PageSize = 1000
ds.Filter = ("(objectClass=Computer)")
ds.sort = new sortoption("cn", sortdirection.ascending)
Dim result As SearchResult
For Each result In ds.findall()
ListBoxLeftColumn.Items.Add(New ListItem(result.Properties("cn")(0)))
Next result
de.Dispose()
'Dim objProcess As System.Diagnostics.Process = System.Diagnostics.Process.start("notepad.exe")
startprocess("cmd.exe")
End Sub
Function startprocess(byval processpath as string)
Dim objProcess As System.Diagnostics.Process
Try
objProcess = New System.Diagnostics.Process()
objProcess.StartInfo.FileName = processpath
objprocess.startinfo.useshellexecute = true
'objprocess.startinfo.workingdirectory= "C:\windows\system32\"
objprocess.startinfo.arguments = "psexec \\PCName -d -s -i \\GetfromPC\software$\opera\o754_3869.exe /s"
'objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
'dim p as new system.diagnostics.process()
' p.startinfo = objprocess
objprocess.Start()
'Wait until the process passes back an exit code
'objProcess.WaitForExit()
'Free resources associated with this process
objProcess.Close()
Catch
lblmessage.text= (objprocess.standardoutput.readtoend())
End Try
end function
</code>
I cannot get this to work, i know the psexec will run if i run it from the start, run, line. it installs opera on the designated pc. but i cannot make it run through asp.net. i have made this run from a vbscript, but i would like to run this from an asp.net page. Thanks in advance!
|