vb.net - How to get output from PowerShell automation? -
i trying output , post output powershell instance textbox. code:
private sub viewservicelogtoolstripmenuitem_click(sender object, e eventargs) handles viewservicelogtoolstripmenuitem.click using ps powershell = powershell.create() dim logfilepathname string = "some path log file" ps.addscript(string.format("get-content {0} -wait", logfilepathname)) dim outputcollection psdatacollection(of psobject) = new psdatacollection(of psobject) addhandler outputcollection.dataadded, addressof logfileoutput dim result iasyncresult = ps.begininvoke(of psobject, psobject)(nothing, outputcollection) end using end sub sub logfileoutput(send object, data dataaddedeventargs) logtextbox.text += data.tostring end sub
i unsure if running. placing break point inside logfileoutput handler sub never raised. thanks.
Comments
Post a Comment