Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Powershell scripts not working with Vista powershell

Reply
 
Old 10-09-2007   #1 (permalink)
Ben


 
 

Powershell scripts not working with Vista powershell

Hi,

I am still in the process of learning Powershell and I am in the middle of
my transition from windows XP to Vista.. I was trying to run one of my
Powershell scripts in my Vista POSH client and it didn't return any
results... I then ran it on my XP powershell client and it worked fine?? i
am very confused are the versions of powershell that much different between
windows OS?

Here is the script...

$erroractionpreference = "silentlyContinue"
$root= new-object System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
$domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
$search = new-object System.DirectoryServices.DirectorySearcher($domain)
$search.filter = '(&(objectCategory=Computer)(operatingSystem=*Server*))'


$computers = $search.findall()| foreach-object {
$comp = $_
$comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
if($comp.name -like "site1*") {write-output $comp.name}
elseif ($comp.name -like "site2*") {write-output $comp.name}
}
$computers.length
$result = foreach-object {
$service = Get-WmiObject -class Win32_Service -computername $computers |
where {$_.name -eq "clussvc"}
Write-output $service
}
$result.length
$result | sort | format-table -autosize systemName,Name,State,Status,startmode

My System SpecsSystem Spec
Old 10-09-2007   #2 (permalink)
Ben


 
 

RE: Powershell scripts not working with Vista powershell

Just to add to the previous post.... if i replace the computer search portion

$erroractionpreference = "silentlyContinue"
$root= new-object System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
$domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
$search = new-object System.DirectoryServices.DirectorySearcher($domain)
$search.filter = '(&(objectCategory=Computer)(operatingSystem=*Server*))'


$computers = $search.findall()| foreach-object {
$comp = $_
$comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
if($comp.name -like "site1*") {write-output $comp.name}
elseif ($comp.name -like "site2*") {write-output $comp.name}
}

With :

$computers = "servername1","servername2","servername3","servername4"

then the following section works fine and displays the value of $result
correctly.

computers.length
$result = foreach-object {
$service = Get-WmiObject -class Win32_Service -computername $computers |
where {$_.name -eq "clussvc"}
Write-output $service
}
$result.length
$result | sort | format-table -autosize
systemName,Name,State,Status,startmode

am i doing something wrong??

any help is great appriciated!!

Thanks in advance
My System SpecsSystem Spec
Old 10-09-2007   #3 (permalink)
Kirk Munro


 
 

Re: Powershell scripts not working with Vista powershell

Hi Ben,

What happens if you comment out your $erroractionpreference =
"silentlyContinue" line in the script and then run it? Does Vista give you
any errors that were previously being hidden?

-
Kirk Munro
Poshoholic
http://poshoholic.com

"Ben" <Ben@xxxxxx> wrote in message
news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
Quote:

> Just to add to the previous post.... if i replace the computer search
> portion
>
> $erroractionpreference = "silentlyContinue"
> $root= new-object
> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
> $search = new-object System.DirectoryServices.DirectorySearcher($domain)
> $search.filter = '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>
>
> $computers = $search.findall()| foreach-object {
> $comp = $_
> $comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
> if($comp.name -like "site1*") {write-output $comp.name}
> elseif ($comp.name -like "site2*") {write-output $comp.name}
> }
>
> With :
>
> $computers = "servername1","servername2","servername3","servername4"
>
> then the following section works fine and displays the value of $result
> correctly.
>
> computers.length
> $result = foreach-object {
> $service = Get-WmiObject -class Win32_Service -computername $computers |
> where {$_.name -eq "clussvc"}
> Write-output $service
> }
> $result.length
> $result | sort | format-table -autosize
> systemName,Name,State,Status,startmode
>
> am i doing something wrong??
>
> any help is great appriciated!!
>
> Thanks in advance

My System SpecsSystem Spec
Old 10-09-2007   #4 (permalink)
Brandon Shell [MVP]


 
 

Re: Powershell scripts not working with Vista powershell

You may have more wrong, but one thing that stands out is your use of
foreach-object... that requires piped input.

$result = foreach-object {
$service = Get-WmiObject -class Win32_Service -computername $computers |
where {$_.name -eq "clussvc"}
Write-output $service
}

There are other things that are more a style issue, but this is the only
thing I see wrong.

"Ben" <Ben@xxxxxx> wrote in message
news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
Quote:

> Just to add to the previous post.... if i replace the computer search
> portion
>
> $erroractionpreference = "silentlyContinue"
> $root= new-object
> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
> $search = new-object System.DirectoryServices.DirectorySearcher($domain)
> $search.filter = '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>
>
> $computers = $search.findall()| foreach-object {
> $comp = $_
> $comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
> if($comp.name -like "site1*") {write-output $comp.name}
> elseif ($comp.name -like "site2*") {write-output $comp.name}
> }
>
> With :
>
> $computers = "servername1","servername2","servername3","servername4"
>
> then the following section works fine and displays the value of $result
> correctly.
>
> computers.length
> $result = foreach-object {
> $service = Get-WmiObject -class Win32_Service -computername $computers |
> where {$_.name -eq "clussvc"}
> Write-output $service
> }
> $result.length
> $result | sort | format-table -autosize
> systemName,Name,State,Status,startmode
>
> am i doing something wrong??
>
> any help is great appriciated!!
>
> Thanks in advance
My System SpecsSystem Spec
Old 10-09-2007   #5 (permalink)
Brandon Shell [MVP]


 
 

Re: Powershell scripts not working with Vista powershell

Can you try this?

$root = new-object System.DirectoryServices.DirectoryEntry("LDAP://RootDSE")
$domain= $root.defaultNamingContext
$search = new-object
System.DirectoryServices.DirectorySearcher($domain,'(&(objectCategory=Computer)(operatingSystem=*Server*))')
$computers = $search.findall() |
where-Object{($comp.properties.dnshostname -match "site1") -or
($comp.properties.dnshostname -match "site2")}
$computers

"Ben" <Ben@xxxxxx> wrote in message
news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
Quote:

> Just to add to the previous post.... if i replace the computer search
> portion
>
> $erroractionpreference = "silentlyContinue"
> $root= new-object
> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
> $search = new-object System.DirectoryServices.DirectorySearcher($domain)
> $search.filter = '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>
>
> $computers = $search.findall()| foreach-object {
> $comp = $_
> $comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
> if($comp.name -like "site1*") {write-output $comp.name}
> elseif ($comp.name -like "site2*") {write-output $comp.name}
> }
>
> With :
>
> $computers = "servername1","servername2","servername3","servername4"
>
> then the following section works fine and displays the value of $result
> correctly.
>
> computers.length
> $result = foreach-object {
> $service = Get-WmiObject -class Win32_Service -computername $computers |
> where {$_.name -eq "clussvc"}
> Write-output $service
> }
> $result.length
> $result | sort | format-table -autosize
> systemName,Name,State,Status,startmode
>
> am i doing something wrong??
>
> any help is great appriciated!!
>
> Thanks in advance
My System SpecsSystem Spec
Old 10-09-2007   #6 (permalink)
Brandon Shell [MVP]


 
 

Re: Powershell scripts not working with Vista powershell

whoops... Try this instead

$root = new-object System.DirectoryServices.DirectoryEntry("LDAP://RootDSE")
$domain= [ADSI]"LDAP://$($root.defaultNamingContext)"
$search = new-object
System.DirectoryServices.DirectorySearcher($domain,'(&(objectCategory=Computer)(operatingSystem=*Server*))')
$computers = $search.findall() |
where-Object{($_.properties.dnshostname -match "site1") -or
($_.properties.dnshostname -match "site2")}
$computers


"Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote in message
news:ev7yGwtCIHA.5228@xxxxxx
Quote:

> Can you try this?
>
> $root = new-object
> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE")
> $domain= $root.defaultNamingContext
> $search = new-object
> System.DirectoryServices.DirectorySearcher($domain,'(&(objectCategory=Computer)(operatingSystem=*Server*))')
> $computers = $search.findall() |
> where-Object{($comp.properties.dnshostname -match "site1") -or
> ($comp.properties.dnshostname -match "site2")}
> $computers
>
> "Ben" <Ben@xxxxxx> wrote in message
> news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
Quote:

>> Just to add to the previous post.... if i replace the computer search
>> portion
>>
>> $erroractionpreference = "silentlyContinue"
>> $root= new-object
>> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
>> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
>> $search = new-object System.DirectoryServices.DirectorySearcher($domain)
>> $search.filter = '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>>
>>
>> $computers = $search.findall()| foreach-object {
>> $comp = $_
>> $comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
>> if($comp.name -like "site1*") {write-output $comp.name}
>> elseif ($comp.name -like "site2*") {write-output $comp.name}
>> }
>>
>> With :
>>
>> $computers = "servername1","servername2","servername3","servername4"
>>
>> then the following section works fine and displays the value of $result
>> correctly.
>>
>> computers.length
>> $result = foreach-object {
>> $service = Get-WmiObject -class Win32_Service -computername $computers |
>> where {$_.name -eq "clussvc"}
>> Write-output $service
>> }
>> $result.length
>> $result | sort | format-table -autosize
>> systemName,Name,State,Status,startmode
>>
>> am i doing something wrong??
>>
>> any help is great appriciated!!
>>
>> Thanks in advance
>
My System SpecsSystem Spec
Old 10-09-2007   #7 (permalink)
Kirk Munro


 
 

Re: Powershell scripts not working with Vista powershell

Hi Brandon,

Actually I was going to post that very same thing because it jumped out at
me too, but then I tested it and it works just fine (on my XP laptop at
least). So while it isn't very intuitive and the use of ForEach-Object is
actually altogether unnecessary for that section of the script, I don't
think it is "wrong". It's just...um...creatively obscure.

-
Kirk Munro
Poshoholic
http://poshoholic.com

"Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote in message
news:eat$3ptCIHA.5160@xxxxxx
Quote:

> You may have more wrong, but one thing that stands out is your use of
> foreach-object... that requires piped input.
>
> $result = foreach-object {
> $service = Get-WmiObject -class Win32_Service -computername $computers |
> where {$_.name -eq "clussvc"}
> Write-output $service
> }
>
> There are other things that are more a style issue, but this is the only
> thing I see wrong.
>
> "Ben" <Ben@xxxxxx> wrote in message
> news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
Quote:

>> Just to add to the previous post.... if i replace the computer search
>> portion
>>
>> $erroractionpreference = "silentlyContinue"
>> $root= new-object
>> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
>> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
>> $search = new-object System.DirectoryServices.DirectorySearcher($domain)
>> $search.filter = '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>>
>>
>> $computers = $search.findall()| foreach-object {
>> $comp = $_
>> $comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
>> if($comp.name -like "site1*") {write-output $comp.name}
>> elseif ($comp.name -like "site2*") {write-output $comp.name}
>> }
>>
>> With :
>>
>> $computers = "servername1","servername2","servername3","servername4"
>>
>> then the following section works fine and displays the value of $result
>> correctly.
>>
>> computers.length
>> $result = foreach-object {
>> $service = Get-WmiObject -class Win32_Service -computername $computers |
>> where {$_.name -eq "clussvc"}
>> Write-output $service
>> }
>> $result.length
>> $result | sort | format-table -autosize
>> systemName,Name,State,Status,startmode
>>
>> am i doing something wrong??
>>
>> any help is great appriciated!!
>>
>> Thanks in advance
>

My System SpecsSystem Spec
Old 10-10-2007   #8 (permalink)
Brandon Shell [MVP]


 
 

Re: Powershell scripts not working with Vista powershell

I apologize... I didn't mean you could use Foreach-Object that way.. I meant
you have to provide some objects to foreach through.

One would need $computers at the end of the foreach-object
foreach-object -process {echo $_} -input @(1..10)

Either way... I agree with you.. remove the $erroractionpreference

"Kirk Munro" <sorry@xxxxxx> wrote in message
news:e0M29wuCIHA.5044@xxxxxx
Quote:

> Hi Brandon,
>
> Actually I was going to post that very same thing because it jumped out at
> me too, but then I tested it and it works just fine (on my XP laptop at
> least). So while it isn't very intuitive and the use of ForEach-Object is
> actually altogether unnecessary for that section of the script, I don't
> think it is "wrong". It's just...um...creatively obscure.
>
> -
> Kirk Munro
> Poshoholic
> http://poshoholic.com
>
> "Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote in message
> news:eat$3ptCIHA.5160@xxxxxx
Quote:

>> You may have more wrong, but one thing that stands out is your use of
>> foreach-object... that requires piped input.
>>
>> $result = foreach-object {
>> $service = Get-WmiObject -class Win32_Service -computername $computers |
>> where {$_.name -eq "clussvc"}
>> Write-output $service
>> }
>>
>> There are other things that are more a style issue, but this is the only
>> thing I see wrong.
>>
>> "Ben" <Ben@xxxxxx> wrote in message
>> news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
Quote:

>>> Just to add to the previous post.... if i replace the computer search
>>> portion
>>>
>>> $erroractionpreference = "silentlyContinue"
>>> $root= new-object
>>> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
>>> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
>>> $search = new-object System.DirectoryServices.DirectorySearcher($domain)
>>> $search.filter =
>>> '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>>>
>>>
>>> $computers = $search.findall()| foreach-object {
>>> $comp = $_
>>> $comp | add-member noteproperty "Name" $comp.properties["name"].item(0)
>>> if($comp.name -like "site1*") {write-output $comp.name}
>>> elseif ($comp.name -like "site2*") {write-output $comp.name}
>>> }
>>>
>>> With :
>>>
>>> $computers = "servername1","servername2","servername3","servername4"
>>>
>>> then the following section works fine and displays the value of $result
>>> correctly.
>>>
>>> computers.length
>>> $result = foreach-object {
>>> $service = Get-WmiObject -class Win32_Service -computername $computers
>>> |
>>> where {$_.name -eq "clussvc"}
>>> Write-output $service
>>> }
>>> $result.length
>>> $result | sort | format-table -autosize
>>> systemName,Name,State,Status,startmode
>>>
>>> am i doing something wrong??
>>>
>>> any help is great appriciated!!
>>>
>>> Thanks in advance
>>
>
>
My System SpecsSystem Spec
Old 10-10-2007   #9 (permalink)
Brandon Shell [MVP]


 
 

Re: Powershell scripts not working with Vista powershell

Btw... I think the reason his orginal Foreach-object worked is because Get-WMIObject
takes an array for computername

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

B> I apologize... I didn't mean you could use Foreach-Object that way..
B> I meant you have to provide some objects to foreach through.
B>
B> One would need $computers at the end of the foreach-object
B> foreach-object -process {echo $_} -input @(1..10)
B>
B> Either way... I agree with you.. remove the $erroractionpreference
B>
B> "Kirk Munro" <sorry@xxxxxx> wrote in message
B> news:e0M29wuCIHA.5044@xxxxxx
B>
Quote:
Quote:

>> Hi Brandon,
>>
>> Actually I was going to post that very same thing because it jumped
>> out at me too, but then I tested it and it works just fine (on my XP
>> laptop at least). So while it isn't very intuitive and the use of
>> ForEach-Object is actually altogether unnecessary for that section of
>> the script, I don't think it is "wrong". It's just...um...creatively
>> obscure.
>>
>> -
>> Kirk Munro
>> Poshoholic
>> http://poshoholic.com
>> "Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote in message
>> news:eat$3ptCIHA.5160@xxxxxx
>>
Quote:

>>> You may have more wrong, but one thing that stands out is your use
>>> of foreach-object... that requires piped input.
>>>
>>> $result = foreach-object {
>>> $service = Get-WmiObject -class Win32_Service -computername
>>> $computers |
>>> where {$_.name -eq "clussvc"}
>>> Write-output $service
>>> }
>>> There are other things that are more a style issue, but this is the
>>> only thing I see wrong.
>>>
>>> "Ben" <Ben@xxxxxx> wrote in message
>>> news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
>>>
>>>> Just to add to the previous post.... if i replace the computer
>>>> search portion
>>>>
>>>> $erroractionpreference = "silentlyContinue"
>>>> $root= new-object
>>>> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
>>>> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
>>>> $search = new-object
>>>> System.DirectoryServices.DirectorySearcher($domain)
>>>> $search.filter =
>>>> '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>>>> $computers = $search.findall()| foreach-object {
>>>> $comp = $_
>>>> $comp | add-member noteproperty "Name"
>>>> $comp.properties["name"].item(0)
>>>> if($comp.name -like "site1*") {write-output $comp.name}
>>>> elseif ($comp.name -like "site2*") {write-output $comp.name}
>>>> }
>>>> With :
>>>>
>>>> $computers =
>>>> "servername1","servername2","servername3","servername4"
>>>>
>>>> then the following section works fine and displays the value of
>>>> $result correctly.
>>>>
>>>> computers.length
>>>> $result = foreach-object {
>>>> $service = Get-WmiObject -class Win32_Service -computername
>>>> $computers
>>>> |
>>>> where {$_.name -eq "clussvc"}
>>>> Write-output $service
>>>> }
>>>> $result.length
>>>> $result | sort | format-table -autosize
>>>> systemName,Name,State,Status,startmode
>>>> am i doing something wrong??
>>>>
>>>> any help is great appriciated!!
>>>>
>>>> Thanks in advance
>>>>

My System SpecsSystem Spec
Old 10-10-2007   #10 (permalink)
Kirk Munro


 
 

Re: Powershell scripts not working with Vista powershell

I'm not so sure. You can execute this one-liner in PowerShell just fine:

$wmiServices = ForEach-Object { Get-Service wmi* }

And after the execution is done, $wmiServices will contain all services that
start with wmi. It surprised me that this would work at all. I wonder if
the PowerShell interpreter is recognizing that ForEach-Object doesn't have
any input and therefore is simply executing the contents. At any rate, the
ForEach-Object cmdlet is not necessary at all in cases like this and can be
removed. My only point was that according to PowerShell it doesn't seem to
be "wrong".

-
Kirk Munro
Poshoholic
http://poshoholic.com

"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f646192c8c9d939ea074264@xxxxxx
Quote:

> Btw... I think the reason his orginal Foreach-object worked is because
> Get-WMIObject takes an array for computername
>
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
>
> B> I apologize... I didn't mean you could use Foreach-Object that way..
> B> I meant you have to provide some objects to foreach through.
> B> B> One would need $computers at the end of the foreach-object
> B> foreach-object -process {echo $_} -input @(1..10)
> B> B> Either way... I agree with you.. remove the $erroractionpreference
> B> B> "Kirk Munro" <sorry@xxxxxx> wrote in message
> B> news:e0M29wuCIHA.5044@xxxxxx
> B>
Quote:
Quote:

>>> Hi Brandon,
>>>
>>> Actually I was going to post that very same thing because it jumped
>>> out at me too, but then I tested it and it works just fine (on my XP
>>> laptop at least). So while it isn't very intuitive and the use of
>>> ForEach-Object is actually altogether unnecessary for that section of
>>> the script, I don't think it is "wrong". It's just...um...creatively
>>> obscure.
>>>
>>> -
>>> Kirk Munro
>>> Poshoholic
>>> http://poshoholic.com
>>> "Brandon Shell [MVP]" <a_bshell@xxxxxx> wrote in message
>>> news:eat$3ptCIHA.5160@xxxxxx
>>>
>>>> You may have more wrong, but one thing that stands out is your use
>>>> of foreach-object... that requires piped input.
>>>>
>>>> $result = foreach-object {
>>>> $service = Get-WmiObject -class Win32_Service -computername
>>>> $computers |
>>>> where {$_.name -eq "clussvc"}
>>>> Write-output $service
>>>> }
>>>> There are other things that are more a style issue, but this is the
>>>> only thing I see wrong.
>>>>
>>>> "Ben" <Ben@xxxxxx> wrote in message
>>>> news:094A48E5-D2EB-4088-9685-73A8411163F8@xxxxxx
>>>>
>>>>> Just to add to the previous post.... if i replace the computer
>>>>> search portion
>>>>>
>>>>> $erroractionpreference = "silentlyContinue"
>>>>> $root= new-object
>>>>> System.DirectoryServices.DirectoryEntry("LDAP://RootDSE");
>>>>> $domain=[adsi]("LDAP://" + $root.Get("defaultNamingContext"));
>>>>> $search = new-object
>>>>> System.DirectoryServices.DirectorySearcher($domain)
>>>>> $search.filter =
>>>>> '(&(objectCategory=Computer)(operatingSystem=*Server*))'
>>>>> $computers = $search.findall()| foreach-object {
>>>>> $comp = $_
>>>>> $comp | add-member noteproperty "Name"
>>>>> $comp.properties["name"].item(0)
>>>>> if($comp.name -like "site1*") {write-output $comp.name}
>>>>> elseif ($comp.name -like "site2*") {write-output $comp.name}
>>>>> }
>>>>> With :
>>>>>
>>>>> $computers =
>>>>> "servername1","servername2","servername3","servername4"
>>>>>
>>>>> then the following section works fine and displays the value of
>>>>> $result correctly.
>>>>>
>>>>> computers.length
>>>>> $result = foreach-object {
>>>>> $service = Get-WmiObject -class Win32_Service -computername
>>>>> $computers
>>>>> |
>>>>> where {$_.name -eq "clussvc"}
>>>>> Write-output $service
>>>>> }
>>>>> $result.length
>>>>> $result | sort | format-table -autosize
>>>>> systemName,Name,State,Status,startmode
>>>>> am i doing something wrong??
>>>>>
>>>>> any help is great appriciated!!
>>>>>
>>>>> Thanks in advance
>>>>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Executing PowerShell Scripts with IIS PowerShell
run PowerShell scripts from ASP or asp.net PowerShell
Can't run powershell scripts PowerShell
Powershell for test scripts PowerShell
powershell logon scripts PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46