Im using Sharepoint 2013 .Net 4.5 and I need run VB script in code behind(C#). This script should scanning my subnet and save new xml with devices in subnet. The script runs and xml file is created but inside I don't have any devices. When I run this script in cmd is ok.
This is my c# code:
string scriptName = "audit_subnet.vbs";
string create_file = "create_file=y";
string submit_online = "submit_online=n";
string subnet = "subnet=" + StartIP.Text + "-" + EndIP.Text;
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"cscript";
startInfo.WorkingDirectory = @"C:\xml";
startInfo.Arguments = string.Format("\"{0}\" \"{1}\" \"{2}\" \"{3}\"", scriptName,create_file, submit_online, subnet);
startInfo.WindowStyle = ProcessWindowStyle.Normal;
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit();
}
In debug:
startInfo.Arguments = "\"audit_subnet.vbs\" \"create_file=y\" \"submit_online=n\" \"subnet=10.70.77.1-10.70.77.1\""
Here is this script(example): https://github.com/ethanhann/open-awesome/blob/master/bin/audit_subnet.vbs
I changed the script myself and it works when I run it in cmd.
Why when I start this script in c# is created file but won't scan subnet?