static void InstallPnkBstr(OptionSet p, string pnkbstrFile, string serviceName)
{
if (ServiceTools.ServiceInstaller.ServiceIsInstalled(serviceName))
{
Console.WriteLine("Service is already installed!");
return;
}
try
{
ServiceTools.ServiceInstaller.Install(serviceName, serviceName, pnkbstrFile);
Console.WriteLine("Service Installed!");
}
catch (System.ApplicationException e)
{
Console.WriteLine("Error installing service (do you have proper privileges?): {0}", e.Message);
}
}