![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | WMI Hi all, sorry for my bad Englisch. I have basic questation about powershell and wmi. I want get instaces for win32_shares class . try: $mc = new-object system.management.managementclass("win32_shares") $mc. getinstances() but command return error . Use powershell framework classes , and how I call correctly getinstances ? thanx marek |
My System Specs![]() |
| | #2 (permalink) |
| XP 2003 SuSE | Re: WMI To get anything WMI in the Powershell, simply Get-WmiObject -Class Win32_BIOS See this article. It explains it all for you. To get the instances, simply say; $disk= WmiObject Win32_LogicalDisk "Drive Letter Size GB " foreach ($drive in $disk ) {"Drive = " + $drive.Name} Cheers L |
My System Specs![]() |
| | #3 (permalink) |
| | Re: WMI Thanx for answer. And if I use create wmi class with preview email , where is error ? "lrbell" wrote: > > To get anything WMI in the Powershell, simply > Get-WmiObject -Class Win32_BIOS > > See this 'article' > (http://www.microsoft.com/technet/scr...wmiobject.mspx). > It explains it all for you. > > Cheers. > > L > > > -- > lrbell > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: WMI In message <8D2CACF5-95EA-49CF-9864-9573FFD87323@microsoft.com>, Marek <Marek@discussions.microsoft.com> writes >Thanx for answer. >And if I use create wmi class with preview email , where is error ? I am not quite sure what you are asking - but there is no wmi class called win32_shares. There _is_ a win32_share class, as shown here: PSH [D:\foo]: gwmi win32_share Name Path Description ---- ---- ----------- E$ E:\ Default share IPC$ Remote IPC D$ D:\ Default share ADMIN$ C:\WINDOWS Remote Admin C$ C:\ Default share PSH [D:\foo]: (gwmi win32_share).count 5 HTH THomas -- Thomas Lee doctordns@gmail.com MVP - Admin Frameworks and Security |
My System Specs![]() |
| | #5 (permalink) |
| | Re: WMI I want connect to the serverfrom second child domain . I write : $p = new-object system.management.managementclass $p.psbase.path="\\fuuslnt2.usl.ul.ds.mfcr.cz\root\microsoftdns:microsoftdns_zone" $p.psbase.getinstances() Exception retrieving members: "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)" if I try : PS H:\> $p = new-object system.management.managementclass PS H:\> $p.psbase.path="\\fuuslnt2.usl.ul.ds.mfcr.cz\root\cimv2:win32_share" PS H:\> $p.psbase.getinstances() this work .... where is trouble ? thanx marek |
My System Specs![]() |
| | #6 (permalink) |
| | Re: WMI if I copy code from VS C# , where the code run ok, powershell return this PS H:\> $ms = new-object System.Management.ManagementScope($pt) PS H:\> $ms.Options.Impersonation = "Impersonate" PS H:\> $ms.Options.Password = "xxx"; PS H:\> $ms.Options.Authority = "NTLMDOMAIN:UL"; PS H:\> $ms.Options.Username = "yyy"; PS H:\> $ms.psbase.Connect(); PS H:\> $mc = new-object system.management.ManagementClass($pt); PS H:\> $mc.psbase.scope = $ms PS H:\> $mc.psbase.GetInstances() Exception calling "GetInstances" with "0" argument(s): "Operation is not valid due to the current state of the object." At line:1 char:24 "Thomas Lee" wrote: > In message <8D2CACF5-95EA-49CF-9864-9573FFD87323@microsoft.com>, Marek > <Marek@discussions.microsoft.com> writes > >Thanx for answer. > >And if I use create wmi class with preview email , where is error ? > > I am not quite sure what you are asking - but there is no wmi class > called win32_shares. There _is_ a win32_share class, as shown here: > > > PSH [D:\foo]: gwmi win32_share > > Name Path > Description > ---- ---- > ----------- > E$ E:\ > Default share > IPC$ > Remote IPC > D$ D:\ > Default share > ADMIN$ C:\WINDOWS > Remote Admin > C$ C:\ > Default share > > > PSH [D:\foo]: (gwmi win32_share).count > 5 > > HTH > > THomas > > > -- > Thomas Lee > doctordns@gmail.com > MVP - Admin Frameworks and Security > |
My System Specs![]() |
| | #7 (permalink) |
| | RE: WMI Try Get-Wmiobject -class win32_ntshare -computer remoteServerNameOrIP HTH. -- ............... All new, all fresh .............. http://www.leedesmond.com/weblog/ "Marek" wrote: > Hi all, > sorry for my bad Englisch. I have basic questation about powershell and wmi. > I want get instaces for win32_shares class . try: > > $mc = new-object system.management.managementclass("win32_shares") > $mc. getinstances() > but command return error . Use powershell framework classes , and how I call > correctly getinstances ? > > thanx > marek |
My System Specs![]() |
| | #8 (permalink) |
| | Re: WMI In message <6DB45474-A8A1-463E-B393-F403931E057C@microsoft.com>, Desmond Lee <mcp@donotspamplease.mars> writes >Try > >Get-Wmiobject -class win32_ntshare -computer remoteServerNameOrIP > >HTH. > PSH [D:\foo]: Get-Wmiobject -class win32_ntshare Get-WmiObject : Invalid class At line:1 char:14 + Get-Wmiobject <<<< -class win32_ntshare The correct class name is win32_share, as in: PSH [D:\foo]: Get-Wmiobject -class win32_share Name Path Description ---- ---- ----------- E$ E:\ Default share IPC$ Remote IPC D$ D:\ Default share ADMIN$ C:\WINDOWS Remote Admin C$ C:\ Default share HTH Thomas -- Thomas Lee doctordns@gmail.com MVP - Admin Frameworks and Security |
My System Specs![]() |