I recently fixed a bug at work where one of our applications could not shutdown the computer it was running on when the user logged out. It turned out the problem was introduced when we recently modified the software to run under a non-administrator account. We had made the system more secure, but the program no longer had sufficient privileges to shutdown the computer. The fix for this was to have the software invoke the shutdown program using an administrator account. Since the solution might be useful to someone else, I’m posting the code that I implemented.
Code appears after the break…
public void ShutdownSystem()
{
// SecureString encrypts the contents in memory to prevent unauthorized access
System.Security.SecureString password = new System.Security.SecureString();
// Create the password a character at a time
password.AppendChar('M');
password.AppendChar('y');
password.AppendChar('@');
password.AppendChar('P');
password.AppendChar('a');
password.AppendChar('s');
password.AppendChar('s');
password.AppendChar('w');
password.AppendChar('o');
password.AppendChar('r');
password.AppendChar('d');
password.MakeReadOnly();
// Invoke the shutdown process, using administrator privileges
System.Diagnostics.Process.Start(@"c:\windows\system32\shutdown.exe",
"-s -t 0 -f", "Administrator", password, "MyDomain");
}
Posted by Al on 01/30/10 at 01:42 PM in C#


Subscribe to our RSS Feeds
©2010 Al Carnali
Comments
Comment by sohbet on Sun, February 21, 2010 at 09:02:15
Thankfully for the fragman patient masses, Avatar has turned out to be the biggest and best event movie of the year, perhaps the decade. The story is pure Cameron simplicity anal porno a paraplegic ex-marine is given a film chance to walk again through the use of a unique alien body, called an sikiş izle Avatar. It is his job to gain the a greedy corporation türk pornosu can steal the precious . Jake’s (Sam Worthington) crippled main character is the contact not only is he new to the visual delights of Pandora but his anal pornolar disability meansis one of glorious freedom from the confinement of his chair. sarışın pornolar When the Corporations intentions become more sinister, Jake must choose between his new found place with the natives and his own race and fight for what he believes in._Oscars, schmoscars. This weekend was all about the best and porno izle brightest in Hollywood animation. At Saturday’s 37th Annual Annie Awards, Pixar’s Up, the little gem that’s also in the running for top honors at sex izle this year’s Academy Awards, was named Best Animated Film and Best Directing in a Feature. dizi To hell with them 4 this kind of cash splash parça kontör in this credit crisis. oyun bu siteden oyun oyna ya bilirsiniz. There are a lot issues to deal with kontür as to bu sitemizden dizi izleye bilirsiniz. regards money and will be appreciated not to hear this from parça kontör the media 4 its publicity stunts. A lot people are dying just because they can’t afford it and Kalou from a parça kontör very poor African country and background 4 charity. 4 the bayan arkadaş good samaritan Terry, that money would save countless lives if you had escort bayanlar donated it to Kanu’s Heart Foundation arkadaş Celebrate what?!!!!.....birthday?.when uhave a ezel izle decisive n test of superiority drink n get drunk n perform woefully against man utd n c wat i’ll kızlarla sohbet do 2 u ppl.y dnt yemek tarifleri kızlarla sohbet u jst postpone d celebratn till after our parça kontör sex izle victory over escort bayanlar man utd n i’ll u gy z seks in getting drunk in my own arkadaşlık siteleri
Comment by Sohbet on Sun, February 21, 2010 at 09:02:49
domain..Up until had seks porno izle been almost entirely a burden: the cost of sikiş izle contraception, the worry of pregnancy, the unsettling presence of blood. With that track record, padding my bank account seemed like the least my ovaries could do for me. My . buraki sitemizinden yerli dizi veya yabancı dizi izleyebilirsiniz. Friends said, “I would never do that.” Older women swore gazeteler I’d regret it. dul bayanlar But I do not miss those 12 eggs, hardly sohbet ever think of them, wouldn’t know them if I film izle passed them in took with the money—to Bangkok, indir Istanbul, Cape Town. Devaluing my body, you say? It sure didn’t feel like that in first class. seks izleintentions become more sinister, Jake must choose between his new found place with the natives and his own race and fight for what kızlık bozma he believes , Jake must choose between his new found place with the natives and his own race and fight for what he believes
Corporations intentions become more sinister,teen videoları Jake must choose between his new found place with the natives and his own race and fight for what he believes When the Corporations intentions porno izle become more sinister, Jake must choose liseli pornosu between his seks izle Corporations intentions become more sinister, Jake must choose between his new found porno izle race and fight for what he believes kız pornosu place with the natives and his own race and fight for what he believesplace with the natives and his own race and fight for what he believes sikiş place with the natives and his own race
Page 1 of 1 pages