Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. win7,sc delete, windows servis,process start

win7,sc delete, windows servis,process start

Scheduled Pinned Locked Moved C#
helpquestion
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tomorrow_ft
    wrote on last edited by
    #1

    hi all, I have used win xp an this code runnig normally but when I started to use win7 it is not working what is it my problem thanks.. foreach (ServiceController service in services) { if (service.ServiceName == "SistemServisleri") { string argu = @"/C sc delete SistemServisleri"; System.Diagnostics.Process.Start(@"c:\Windows\system32\cmd.exe", argu);// for win7 I used it but not working System.Diagnostics.Process.Start("cmd", argu);// for winxp I used it and working } }

    N B 2 Replies Last reply
    0
    • T tomorrow_ft

      hi all, I have used win xp an this code runnig normally but when I started to use win7 it is not working what is it my problem thanks.. foreach (ServiceController service in services) { if (service.ServiceName == "SistemServisleri") { string argu = @"/C sc delete SistemServisleri"; System.Diagnostics.Process.Start(@"c:\Windows\system32\cmd.exe", argu);// for win7 I used it but not working System.Diagnostics.Process.Start("cmd", argu);// for winxp I used it and working } }

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Have you debugged it? Does the service exist? What do you mean it doesn't work? Does it not run? Does it through an exception? Please format any code you post using the pre tags, i.e. the "code block" link in the edit menu.


      I know the language. I've read a book. - _Madmatt

      T 1 Reply Last reply
      0
      • N Not Active

        Have you debugged it? Does the service exist? What do you mean it doesn't work? Does it not run? Does it through an exception? Please format any code you post using the pre tags, i.e. the "code block" link in the edit menu.


        I know the language. I've read a book. - _Madmatt

        T Offline
        T Offline
        tomorrow_ft
        wrote on last edited by
        #3

        I want to delete this servis with this code but it can't be deleted

        1 Reply Last reply
        0
        • T tomorrow_ft

          hi all, I have used win xp an this code runnig normally but when I started to use win7 it is not working what is it my problem thanks.. foreach (ServiceController service in services) { if (service.ServiceName == "SistemServisleri") { string argu = @"/C sc delete SistemServisleri"; System.Diagnostics.Process.Start(@"c:\Windows\system32\cmd.exe", argu);// for win7 I used it but not working System.Diagnostics.Process.Start("cmd", argu);// for winxp I used it and working } }

          B Offline
          B Offline
          Bernhard Hiller
          wrote on last edited by
          #4

          Is it a UAC (user account control) problem? Even if you are a member of the admin group, you must run that program "as administrator" explicitly.

          T 1 Reply Last reply
          0
          • B Bernhard Hiller

            Is it a UAC (user account control) problem? Even if you are a member of the admin group, you must run that program "as administrator" explicitly.

            T Offline
            T Offline
            tomorrow_ft
            wrote on last edited by
            #5

            for administrator I use System.Diagnostics.Process.Start(@__"c:\Windows\system32\cmd.exe__", argu);

            D 1 Reply Last reply
            0
            • T tomorrow_ft

              for administrator I use System.Diagnostics.Process.Start(@__"c:\Windows\system32\cmd.exe__", argu);

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              YOur code has to run as an administrator. Under Vista and 7, even an admin account doesn't run as an admin account until the privilege requires it and you get the UAC box. To get around that UAC box, you have to create a manifest file in your project that specifies the app needs admin level permissions to run. Here's[^] a quick'n'dirty on what you need to do.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak

              S 1 Reply Last reply
              0
              • D Dave Kreskowiak

                YOur code has to run as an administrator. Under Vista and 7, even an admin account doesn't run as an admin account until the privilege requires it and you get the UAC box. To get around that UAC box, you have to create a manifest file in your project that specifies the app needs admin level permissions to run. Here's[^] a quick'n'dirty on what you need to do.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak

                S Offline
                S Offline
                Sunil G 3
                wrote on last edited by
                #7

                Have u tried it to using WMI?

                D 1 Reply Last reply
                0
                • S Sunil G 3

                  Have u tried it to using WMI?

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  The code needs to be running as an admin regardless of how you do it.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups