473,513 Members | 2,537 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# command Line netsh help!


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.
Oct 20 '06 #1
2 9136
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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Oct 21 '06 #2
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

"Jani Järvinen [MVP]" wrote:
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
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Oct 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4716
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the following for the command-line arguments: java -jar sforcedataloader.jar -Dsalesforce.config.dir=CONFIG_DIRECTORY They also give an example:
12
5306
by: Rhino | last post by:
I am having an odd problem: the sqlj command on my system doesn't work. I am running DB2 (LUW) V8 (FP8) on WinXP. I haven't done an sqlj program since Version 6 of DB2 (LUW) so I checked the manuals for the proper techniques to prepare an sqlj program. When I went to try the sqlj command, I got this: Exception in thread "main"...
5
3208
by: randyelliott | last post by:
Good Day, I have a MS Access (Access 2000 now upgraded to 2003) database that tracks customer information. One function of this database is to create an encrypted license file for our software, which is then emailed out to the customer. The encryption string is based on information in the database and can only be generated by executing a...
2
5864
by: Adam Clauss | last post by:
I am building a GUI to wrap around some of the information/abilities contained within the program netsh. I have figured out how to use redirect the standardinput and standardoutput so that I can read/write from my application. The "easy" way to do this would be to spawn an instance of netsh everytime I need to execute a command, write the...
34
6822
by: Roman Mashak | last post by:
Hello, All! I'm implementing simple CLI (flat model, no tree-style menu etc.). Command line looks like this: <command> <param1> <param2> ... <paramN> (where N=1..4) And idea is pretty simple: 1) get whole string of input line 2) preset table of strings matching <command> 3) preset table of function calls
5
3392
by: clsmith66 | last post by:
I've been asked to find out if a project is possible, but I'm not having much luck finding the information I need, I hope some one can help. I need to see if I can build a windows service on the fly customized to a specific client. Is it possible to run the VS command line tool through another application (VB.NET)? I'm thinking I can run the...
51
4084
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under Command Prompt or Browser or some other application? Ojas.
7
9335
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should display the Windows form. The form is being displayed but the command only returns when the form is closed. I want the command line to return...
2
13387
by: =?Utf-8?B?U2NvdHQ=?= | last post by:
I have seen numerous posts, both here and google, where people are having this issue, but I have yet to see an explanation of the problem. I have a WCF service that is working fine using http. But now we need to upgrade it to use SSL. To do this we need to install and register a server certificate. I got a certificate (Web Server) from...
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7565
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7128
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3255
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3242
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.