![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | exception calling .net object Hi, i'm trying to script management of services on remote computers. Below is my script, Exception calling "GetServices" with "1" argument(s): "Cannot open Service Control Manager on computer 'localhost'. This operation might require other privileges." At line 5, position 64 $LOADSVC=[System.ServiceProcess.ServiceController]::GetServices($Server) .. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: exception calling .net object Hi, i'm trying to script management of services on remote computers. Below is my script, Exception calling "GetServices" with "1" argument(s): "Cannot open Service Control Manager on computer 'localhost'. This operation might require other privileges." At line 5, position 64 $LOADSVC=[System.ServiceProcess.ServiceController]::GetServices($Server) .. .. .. .. .. when i run the script I'm getting the below error Exception calling "GetServices" with "1" argument(s): "Cannot open Service Control Manager on computer 'localhost'. This operation might require other privileges." At line 5, position 64 $LOADSVC=[System.ServiceProcess.ServiceController]::GetServices($Server) Could anyone help me on this.. not sure where and how to define the object. thanks |
My System Specs![]() |
| | #3 (permalink) |
| | Re: exception calling .net object I'm sorry... my script would be the below one, $Services=get-content “c:\Services.txt” $Servers=get-content “c:\Servers.txt” ForEach($Server in $Servers) { $LOADSVC=[System.ServiceProcess.ServiceController]::GetServices($Server) . . . . please help |
My System Specs![]() |
| | #4 (permalink) |
| | Re: exception calling .net object Rajeev wrote: Quote: > I'm sorry... my script would be the below one, > > $Services=get-content “c:\Services.txt” > $Servers=get-content “c:\Servers.txt” > ForEach($Server in $Servers) { > $LOADSVC=[System.ServiceProcess.ServiceController]::GetServices($Server) > . > . > . > . > please help [System.ServiceProcess.ServiceController]::GetServices("127.0.0.1")<--WORKS [System.ServiceProcess.ServiceController]::GetServices("localhost")<--FAILS Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #5 (permalink) |
| | Re: exception calling .net object Thanks, that works fine. Is there another way where i can use the host name and manage services? |
My System Specs![]() |
| | #6 (permalink) |
| | Re: exception calling .net object Rajeev wrote: Quote: > Thanks, that works fine. Is there another way where i can use the host > name and manage services? use that, if only temporarily in the script. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #7 (permalink) |
| | Re: exception calling .net object On Jun 23, 2:52*pm, Rajeev <s.raje...@xxxxxx> wrote: Quote: > Thanks, that works fine. Is there another way where i can use the host > name and manage services? and remote services: get-service -computer <remotemachine> or get-service (for localhost) hope this helps, - Oisin |
My System Specs![]() |
| | #8 (permalink) |
| | Re: exception calling .net object Oisin (x0n) Grehan [MVP] wrote: Quote: > On Jun 23, 2:52 pm, Rajeev <s.raje...@xxxxxx> wrote: Quote: >> Thanks, that works fine. Is there another way where i can use the host >> name and manage services? > Powershell actually has some cmdlets built in that can manage local > and remote services: > > get-service -computer <remotemachine> be in CTP2 also (I don't have the two running at this time to check). Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Object cast exception at runtime | .NET General | |||
| Exception calling "CreateInstance" with "2" argument(s): for Microsoft.Update.UpdateColl | PowerShell | |||
| Problem calling interface of .NET Remoted object via Powershell | PowerShell | |||
| exception when calling a method: object is read-only | PowerShell | |||