C# command Line netsh help!

G

Guest

I'm using c# to called a command line netsh ipsec static.... and the group
policy store it on local even those I used "ipsec static set store
location=domain"

my question is how do I keep the command line is in the netsh eviroment?

protected virtual void Init()
{
// set Process invariant part of startup info
m_proc.StartInfo.CreateNoWindow =
m_proc.StartInfo.RedirectStandardError =
m_proc.StartInfo.RedirectStandardInput =
m_proc.StartInfo.RedirectStandardOutput = true;
m_proc.StartInfo.UseShellExecute = m_proc.StartInfo.ErrorDialog
= false;
m_proc.StartInfo.FileName = "netsh";

//Cause 'Exited' event to be raised on process termination.
m_proc.EnableRaisingEvents = true;

} // Init()

..........

m_proc.StartInfo.Arguments = m_strArguments;
if (!m_proc.Start()) return false; // start process
.......

thanks for any help.
 
J

Jani Järvinen [MVP]

Hello,
I'm using c# to called a command line netsh ipsec static....
my question is how do I keep the command line is in the netsh eviroment?

Unfortunately, to me your question isn't completely clear, what do you mean
by saying you want to keep the command line in the netsh environment?

Also, your problem probably isn't C# related. Have you tried executing netsh
directly (interactively) on the command line? Does it work then? If not,
then it isn't a C# problem but instead a netsh and/or environment issue.

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
G

Guest

Yes, I had try the command line using netsh and ipsec and it work perfectly.
from command prompt

WORK:
----------------
c:\netsh
netsh>ipsec static <do all generated policy here>

NOT WORK:
-------------
c:\netsh ipsec static <do all generated policy here>

in my C# I initial m_proc.StartInfo.FileName = "netsh"; and every time I
called an ipsec command it just add the argument to "netsh" command and it
become "netsh ipsec static <do all generated policy here>"

Is there a way I can do a command line like
netsh>ipsec static <do all generated policy here>
netsh>ipsec static <do policy 2>
netsh>ipsec static <do policy3>
netsh>.....

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top