Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Get-WmiObject : Invalid class for SQLServiceAdvancedProperty Expand / Collapse
Author
Message
Posted Wednesday, May 23, 2012 10:18 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, December 04, 2013 12:31 PM
Points: 52, Visits: 359
Greetings! I have a command(below) in a powershell script that has been working for well over a year, but started failing about 4 days ago. I'm at a beginner level with powershell so it's not clear to me what's wrong. I've done some searching on the web to find out if anyone else has had issues with the SqlServiceAdvancedProperty being invalid, but I didn't find anything.

Two different things happened the day this started happening. 1) I installed SQL PSX 2.3.2.1 . I installed the same powershell mod on another server and the command below works just fine on the other server so I'm not convinced the mod caused the issue. 2) there were windows updates applied to the server. The server was rebooted after the updates.

If anyone has any suggestions on what my next steps should be for troubleshooting this issue, I would greatly appreciate it.

The command:

Get-WmiObject -Class "SqlServiceAdvancedProperty" -Namespace "root/Microsoft/SqlServer/ComputerManagement10" |? { $_.SqlServiceType -eq 1 } |% { $_.ServiceName } | Sort -Unique

the error:

Get-WmiObject : Invalid class
At line:1 char:14 + Get-WmiObject <<<< -Class "SqlServiceAdvancedProperty" -Namespace "root/Microsoft/SqlServer/ComputerManagement10" |?
{ $_.SqlServiceType -eq 1 } |% { $_.ServiceName } | Sort -Unique
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand


Thank you,
Kim
Post #1305113
Posted Wednesday, May 23, 2012 12:46 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, December 04, 2013 12:31 PM
Points: 52, Visits: 359
Turns out WMI was hosed so it wasn't just that class that was missing :) I repaired SQL Server and my script started working again.

Thanks,
Kim
Post #1305285
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse