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 - Acces right with WMI Method

Reply
 
Old 04-29-2009   #1 (permalink)
pg


 
 

Acces right with WMI Method

Hi,

I have a script to stop windows services.For this script, people must use a
special user\pwd.
This is a part of my script :

$credential = Get-Credential

$services =(Get-WmiObject -Credential $credential -computer u6mulw113
Win32_Service | where-object -Filterscript {$_.Name -like 'DEX*'})

foreach ($service in $services){
$nom =$service.Name
(Get-WmiObject -Credential $credential -computer u6mulw113 Win32_Service
-Filter "Name='$nom'").StopService()
}

StopService method doesn't run with credential option.

Question : How i can use credential to stop a service !

My System SpecsSystem Spec
Old 04-29-2009   #2 (permalink)
Vadims Podans [MVP]


 
 

Re: Acces right with WMI Method

can you tell your PowerShell version?
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

"pg" <pg@xxxxxx> rakstīja ziņojumā
"news:0ABCD8E9-023D-4BA2-8AE1-A886074A70F5@xxxxxx"...
Quote:

> Hi,
>
> I have a script to stop windows services.For this script, people must use
> a
> special user\pwd.
> This is a part of my script :
>
> $credential = Get-Credential
>
> $services =(Get-WmiObject -Credential $credential -computer u6mulw113
> Win32_Service | where-object -Filterscript {$_.Name -like 'DEX*'})
>
> foreach ($service in $services){
> $nom =$service.Name
> (Get-WmiObject -Credential $credential -computer u6mulw113 Win32_Service
> -Filter "Name='$nom'").StopService()
> }
>
> StopService method doesn't run with credential option.
>
> Question : How i can use credential to stop a service !
My System SpecsSystem Spec
Old 04-29-2009   #3 (permalink)
pg


 
 

Re: Acces right with WMI Method

PowerShell version is 1.0 on windows 2008 server.


"Vadims Podans [MVP]" wrote:
Quote:

> can you tell your PowerShell version?
> --
> WBR, Vadims Podans
> MVP: PowerShell
> PowerShell blog - www.sysadmins.lv
>
> "pg" <pg@xxxxxx> rakstīja ziņojumā
> "news:0ABCD8E9-023D-4BA2-8AE1-A886074A70F5@xxxxxx"...
Quote:

> > Hi,
> >
> > I have a script to stop windows services.For this script, people must use
> > a
> > special user\pwd.
> > This is a part of my script :
> >
> > $credential = Get-Credential
> >
> > $services =(Get-WmiObject -Credential $credential -computer u6mulw113
> > Win32_Service | where-object -Filterscript {$_.Name -like 'DEX*'})
> >
> > foreach ($service in $services){
> > $nom =$service.Name
> > (Get-WmiObject -Credential $credential -computer u6mulw113 Win32_Service
> > -Filter "Name='$nom'").StopService()
> > }
> >
> > StopService method doesn't run with credential option.
> >
> > Question : How i can use credential to stop a service !
>
>
My System SpecsSystem Spec
Old 04-29-2009   #4 (permalink)
Vadims Podans [MVP]


 
 

Re: Acces right with WMI Method

PowerShell 1.0 have a bug with invoking WMI methods on remote computers
using alternate credentials. Using alternate credentials you can access to
WMI properties, but not methods. In V2 this issue is resolved.
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

"pg" <pg@xxxxxx> rakstīja ziņojumā
"news:026035CD-B939-4A73-83E6-07EE7E8940DB@xxxxxx"...
Quote:

> PowerShell version is 1.0 on windows 2008 server.
>
>
> "Vadims Podans [MVP]" wrote:
>
Quote:

>> can you tell your PowerShell version?
>> --
>> WBR, Vadims Podans
>> MVP: PowerShell
>> PowerShell blog - www.sysadmins.lv
>>
>> "pg" <pg@xxxxxx> rakstīja ziņojumā
>> "news:0ABCD8E9-023D-4BA2-8AE1-A886074A70F5@xxxxxx"...
Quote:

>> > Hi,
>> >
>> > I have a script to stop windows services.For this script, people must
>> > use
>> > a
>> > special user\pwd.
>> > This is a part of my script :
>> >
>> > $credential = Get-Credential
>> >
>> > $services =(Get-WmiObject -Credential $credential -computer u6mulw113
>> > Win32_Service | where-object -Filterscript {$_.Name -like 'DEX*'})
>> >
>> > foreach ($service in $services){
>> > $nom =$service.Name
>> > (Get-WmiObject -Credential $credential -computer u6mulw113
>> > Win32_Service
>> > -Filter "Name='$nom'").StopService()
>> > }
>> >
>> > StopService method doesn't run with credential option.
>> >
>> > Question : How i can use credential to stop a service !
>>
>>
My System SpecsSystem Spec
Old 04-29-2009   #5 (permalink)
pg


 
 

Re: Acces right with WMI Method

Thanks but Powershell is a beta software ?
Can we use it in a production system ?

"Vadims Podans [MVP]" wrote:
Quote:

> PowerShell 1.0 have a bug with invoking WMI methods on remote computers
> using alternate credentials. Using alternate credentials you can access to
> WMI properties, but not methods. In V2 this issue is resolved.
> --
> WBR, Vadims Podans
> MVP: PowerShell
> PowerShell blog - www.sysadmins.lv
>
> "pg" <pg@xxxxxx> rakstīja ziņojumā
> "news:026035CD-B939-4A73-83E6-07EE7E8940DB@xxxxxx"...
Quote:

> > PowerShell version is 1.0 on windows 2008 server.
> >
> >
> > "Vadims Podans [MVP]" wrote:
> >
Quote:

> >> can you tell your PowerShell version?
> >> --
> >> WBR, Vadims Podans
> >> MVP: PowerShell
> >> PowerShell blog - www.sysadmins.lv
> >>
> >> "pg" <pg@xxxxxx> rakstīja ziņojumā
> >> "news:0ABCD8E9-023D-4BA2-8AE1-A886074A70F5@xxxxxx"...
> >> > Hi,
> >> >
> >> > I have a script to stop windows services.For this script, people must
> >> > use
> >> > a
> >> > special user\pwd.
> >> > This is a part of my script :
> >> >
> >> > $credential = Get-Credential
> >> >
> >> > $services =(Get-WmiObject -Credential $credential -computer u6mulw113
> >> > Win32_Service | where-object -Filterscript {$_.Name -like 'DEX*'})
> >> >
> >> > foreach ($service in $services){
> >> > $nom =$service.Name
> >> > (Get-WmiObject -Credential $credential -computer u6mulw113
> >> > Win32_Service
> >> > -Filter "Name='$nom'").StopService()
> >> > }
> >> >
> >> > StopService method doesn't run with credential option.
> >> >
> >> > Question : How i can use credential to stop a service !
> >>
> >>
>
My System SpecsSystem Spec
Old 04-29-2009   #6 (permalink)
Vadims Podans [MVP]


 
 

Re: Acces right with WMI Method

At this time V2 is CTP3 (this equals prebeta status). I don't use V2 in
production systems, only at home and test lab. Respectively CTP3 is
relatively stable you can use V2, however issues may occur.
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

"pg" <pg@xxxxxx> rakstīja ziņojumā
"news:42D3A81E-55B7-4D15-96E8-0A61FAF75F40@xxxxxx"...
Quote:

> Thanks but Powershell is a beta software ?
> Can we use it in a production system ?
>
> "Vadims Podans [MVP]" wrote:
>
Quote:

>> PowerShell 1.0 have a bug with invoking WMI methods on remote computers
>> using alternate credentials. Using alternate credentials you can access
>> to
>> WMI properties, but not methods. In V2 this issue is resolved.
>> --
>> WBR, Vadims Podans
>> MVP: PowerShell
>> PowerShell blog - www.sysadmins.lv
>>
>> "pg" <pg@xxxxxx> rakstīja ziņojumā
>> "news:026035CD-B939-4A73-83E6-07EE7E8940DB@xxxxxx"...
Quote:

>> > PowerShell version is 1.0 on windows 2008 server.
>> >
>> >
>> > "Vadims Podans [MVP]" wrote:
>> >
>> >> can you tell your PowerShell version?
>> >> --
>> >> WBR, Vadims Podans
>> >> MVP: PowerShell
>> >> PowerShell blog - www.sysadmins.lv
>> >>
>> >> "pg" <pg@xxxxxx> rakstīja ziņojumā
>> >> "news:0ABCD8E9-023D-4BA2-8AE1-A886074A70F5@xxxxxx"...
>> >> > Hi,
>> >> >
>> >> > I have a script to stop windows services.For this script, people
>> >> > must
>> >> > use
>> >> > a
>> >> > special user\pwd.
>> >> > This is a part of my script :
>> >> >
>> >> > $credential = Get-Credential
>> >> >
>> >> > $services =(Get-WmiObject -Credential $credential -computer
>> >> > u6mulw113
>> >> > Win32_Service | where-object -Filterscript {$_.Name -like 'DEX*'})
>> >> >
>> >> > foreach ($service in $services){
>> >> > $nom =$service.Name
>> >> > (Get-WmiObject -Credential $credential -computer u6mulw113
>> >> > Win32_Service
>> >> > -Filter "Name='$nom'").StopService()
>> >> > }
>> >> >
>> >> > StopService method doesn't run with credential option.
>> >> >
>> >> > Question : How i can use credential to stop a service !
>> >>
>> >>
>>
My System SpecsSystem Spec
Old 04-30-2009   #7 (permalink)
pg


 
 

Re: Acces right with WMI Method

Thanks Vadims for your help. All it's right with V2.

"Vadims Podans [MVP]" wrote:
Quote:

> At this time V2 is CTP3 (this equals prebeta status). I don't use V2 in
> production systems, only at home and test lab. Respectively CTP3 is
> relatively stable you can use V2, however issues may occur.
> --
> WBR, Vadims Podans
> MVP: PowerShell
> PowerShell blog - www.sysadmins.lv
>
> "pg" <pg@xxxxxx> rakstīja ziņojumā
> "news:42D3A81E-55B7-4D15-96E8-0A61FAF75F40@xxxxxx"...
Quote:

> > Thanks but Powershell is a beta software ?
> > Can we use it in a production system ?
> >
> > "Vadims Podans [MVP]" wrote:
> >
Quote:

> >> PowerShell 1.0 have a bug with invoking WMI methods on remote computers
> >> using alternate credentials. Using alternate credentials you can access
> >> to
> >> WMI properties, but not methods. In V2 this issue is resolved.
> >> --
> >> WBR, Vadims Podans
> >> MVP: PowerShell
> >> PowerShell blog - www.sysadmins.lv
> >>
> >> "pg" <pg@xxxxxx> rakstīja ziņojumā
> >> "news:026035CD-B939-4A73-83E6-07EE7E8940DB@xxxxxx"...
> >> > PowerShell version is 1.0 on windows 2008 server.
> >> >
> >> >
> >> > "Vadims Podans [MVP]" wrote:
> >> >
> >> >> can you tell your PowerShell version?
> >> >> --
> >> >> WBR, Vadims Podans
> >> >> MVP: PowerShell
> >> >> PowerShell blog - www.sysadmins.lv
> >> >>
> >> >> "pg" <pg@xxxxxx> rakstīja ziņojumā
> >> >> "news:0ABCD8E9-023D-4BA2-8AE1-A886074A70F5@xxxxxx"...
> >> >> > Hi,
> >> >> >
> >> >> > I have a script to stop windows services.For this script, people
> >> >> > must
> >> >> > use
> >> >> > a
> >> >> > special user\pwd.
> >> >> > This is a part of my script :
> >> >> >
> >> >> > $credential = Get-Credential
> >> >> >
> >> >> > $services =(Get-WmiObject -Credential $credential -computer
> >> >> > u6mulw113
> >> >> > Win32_Service | where-object -Filterscript {$_.Name -like 'DEX*'})
> >> >> >
> >> >> > foreach ($service in $services){
> >> >> > $nom =$service.Name
> >> >> > (Get-WmiObject -Credential $credential -computer u6mulw113
> >> >> > Win32_Service
> >> >> > -Filter "Name='$nom'").StopService()
> >> >> > }
> >> >> >
> >> >> > StopService method doesn't run with credential option.
> >> >> >
> >> >> > Question : How i can use credential to stop a service !
> >> >>
> >> >>
> >>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Solved Acces problems Microsoft Office
Method invocation failed because [System.String] doesn't contain a method PowerShell
Cannot acces Vista from XP Vista networking & sharing
Can't acces other computer Vista networking & sharing
Acces to progs. Vista installation & setup


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