![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Creating a new service using WIN32_service Does anyone know of any articles that describe how to create a new service using WIN32_Service? There are plently of examples of how to manipulate existing services but haven't had any luck on doing a creation of a new one. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Creating a new service using WIN32_service On Aug 14, 10:38 am, Nibor <Ni...@discussions.microsoft.com> wrote: > Does anyone know of any articles that describe how to create a new service > using WIN32_Service? There are plently of examples of how to manipulate > existing services but haven't had any luck on doing a creation of a new one. Good exercise. Let's see, start here: Create Method of the Win32_Service Class http://msdn2.microsoft.com/en-us/library/aa389390.aspx uint32 Create( string Name, string DisplayName, string PathName, uint8 ServiceType, uint8 ErrorControl, string StartMode, boolean DesktopInteract, string StartName, string StartPassword, string LoadOrderGroup, string [] LoadOrderGroupDependencies, string [] ServiceDependencies ); I'm going to try to come up with some code myself, maybe someone can beat me to it though. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Creating a new service using WIN32_service To be a little more specific here I have tried the following: ps> $service = [wmiclass]'win32_service' ps> $newservice = $service.createinstance() At this point I have tried multiple things: I have tried to assign all properties like the following: PS> $newservice.Name = "Service name" etc... it works fine until the put is tried I get this: PS> $newservice.put() Exception calling "Put" with "0" argument(s): "Exception calling "Put" with "0" argument(s): "Unsupported parameter "" I also tried to just call the create but I get this: PS>$newservice.create('Service Name','Service Name','C:\Program Files\Service.exe',16,0,'Auto',$False,'domain/user','','','','') Exception calling "Create" : "Operation is not valid due to the current state of the object." "Hal Rottenberg" wrote: > On Aug 14, 10:38 am, Nibor <Ni...@discussions.microsoft.com> wrote: > > Does anyone know of any articles that describe how to create a new service > > using WIN32_Service? There are plently of examples of how to manipulate > > existing services but haven't had any luck on doing a creation of a new one. > > Good exercise. Let's see, start here: > > Create Method of the Win32_Service Class > http://msdn2.microsoft.com/en-us/library/aa389390.aspx > > uint32 Create( > string Name, > string DisplayName, > string PathName, > uint8 ServiceType, > uint8 ErrorControl, > string StartMode, > boolean DesktopInteract, > string StartName, > string StartPassword, > string LoadOrderGroup, > string [] LoadOrderGroupDependencies, > string [] ServiceDependencies > ); > > I'm going to try to come up with some code myself, maybe someone can > beat me to it though. > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Creating a new service using WIN32_service Is there a reason for using Win32_Service rather than New-Service -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Nibor" wrote: > > To be a little more specific here I have tried the following: > ps> $service = [wmiclass]'win32_service' > ps> $newservice = $service.createinstance() > > At this point I have tried multiple things: I have tried to assign all > properties like the following: > PS> $newservice.Name = "Service name" > etc... > it works fine until the put is tried I get this: > PS> $newservice.put() > Exception calling "Put" with "0" argument(s): "Exception calling "Put" with > "0" argument(s): "Unsupported parameter "" > > I also tried to just call the create but I get this: > > PS>$newservice.create('Service Name','Service Name','C:\Program > Files\Service.exe',16,0,'Auto',$False,'domain/user','','','','') > Exception calling "Create" : "Operation is not valid due to the current > state of the object." > > > > > > > "Hal Rottenberg" wrote: > > > On Aug 14, 10:38 am, Nibor <Ni...@discussions.microsoft.com> wrote: > > > Does anyone know of any articles that describe how to create a new service > > > using WIN32_Service? There are plently of examples of how to manipulate > > > existing services but haven't had any luck on doing a creation of a new one. > > > > Good exercise. Let's see, start here: > > > > Create Method of the Win32_Service Class > > http://msdn2.microsoft.com/en-us/library/aa389390.aspx > > > > uint32 Create( > > string Name, > > string DisplayName, > > string PathName, > > uint8 ServiceType, > > uint8 ErrorControl, > > string StartMode, > > boolean DesktopInteract, > > string StartName, > > string StartPassword, > > string LoadOrderGroup, > > string [] LoadOrderGroupDependencies, > > string [] ServiceDependencies > > ); > > > > I'm going to try to come up with some code myself, maybe someone can > > beat me to it though. > > > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Creating a new service using WIN32_service On Aug 15, 7:42 am, RichS <Ri...@discussions.microsoft.com> wrote: > Is there a reason for using Win32_Service rather than New-Service I don't know about Nibor but I want to do this against a remote computer. |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Creating a new service using WIN32_service Me too. I have tried to Push-Location to a remote machine then run New-service against it and it tries to create locally. I am still trying though. If anyone has any ideas about using WIN32_Service instead please post. "Hal Rottenberg" wrote: > On Aug 15, 7:42 am, RichS <Ri...@discussions.microsoft.com> wrote: > > Is there a reason for using Win32_Service rather than New-Service > > I don't know about Nibor but I want to do this against a remote > computer. > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| re: Creating an Installer for a Service and an Application | .NET General | |||
| Creating a Windows Service | .NET General | |||
| win32_service - Log On Tab | PowerShell | |||
| Difference between get-service and wmi object win32_service | PowerShell | |||