Console app using MBSACLI

  • Thread starter Thread starter Keith Grefski
  • Start date Start date
K

Keith Grefski

I have the following code that works as long as I dont add the switch -h

'Dim sStartInfo As String = "/hf -z -s 1 -h " & CompName & ""
Dim sStartInfo As String = "/hf -z -s 1"
With securityprocess.StartInfo
.FileName = "C:\Program Files\Microsoft Baseline Security
Analyzer\mbsacli"
.Arguments = sStartInfo
.UseShellExecute = False
.CreateNoWindow = True
.RedirectStandardOutput = True
.RedirectStandardError = True
.RedirectStandardInput = True
End With
securityprocess.Start()

Do While Not securityprocess.HasExited
securityString = securityprocess.StandardOutput.ReadLine
Console.WriteLine(securityString)
Loop


any ideas why the switch for remote fails?

thanks

Keith
 
Keith Grefski said:
I have the following code that works as long as I dont add the switch -h

'Dim sStartInfo As String = "/hf -z -s 1 -h " & CompName & ""

What is CompName defined as?


And what error do you get?
 
Daniel said:
What is CompName defined as?


And what error do you get?
CompName is defined as a string

I dont get an error it just hangs at the line
securityString = securityprocess.StandardOutput.ReadLine
and doesnt error out.
 
Keith Grefski said:
CompName is defined as a string

I dont get an error it just hangs at the line
securityString = securityprocess.StandardOutput.ReadLine
and doesnt error out.

Are you sure the process is generating output?
 
Daniel said:
Daniel O'Connell [C# MVP] wrote:

I have the following code that works as long as I dont add the switch -h

'Dim sStartInfo As String = "/hf -z -s 1 -h " & CompName & ""


What is CompName defined as?


And what error do you get?

CompName is defined as a string

I dont get an error it just hangs at the line
securityString = securityprocess.StandardOutput.ReadLine
and doesnt error out.


Are you sure the process is generating output?
Yes it does if run from the command line alone.
One interesting thing I found was that if I use the -x option to specify
where the XML file is located it does run (slowly but runs) I wonder if
vb.net has an issue with mbsacli making a web call to retrieve the xml file
 
Back
Top