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 - Running WMI Query in without Powershell or VBS

Reply
 
Old 08-22-2007   #1 (permalink)
greatbarrier86


 
 

Running WMI Query in without Powershell or VBS

Hi,

is it possible to call a windows API to get the wmi information? Some of the
computers in my company do not have PowerShell on them so we need to come up
with a better way. Also, can these queries be run in cmd.exe?

My System SpecsSystem Spec
Old 08-22-2007   #2 (permalink)
Brandon Shell


 
 

Re: Running WMI Query in without Powershell or VBS

You don't need powershell to remotely query wmi
user the -computername parameter for get-wmiobject
PS> get-wmiobject Win32_Services -computername server1

You can also use wmic
http://www.microsoft.com/resources/d...n-us/wmic.mspx

"greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
news:36F1E9D2-53BA-4D10-B1DB-C8F02F9DE779@microsoft.com...
> Hi,
>
> is it possible to call a windows API to get the wmi information? Some of
> the
> computers in my company do not have PowerShell on them so we need to come
> up
> with a better way. Also, can these queries be run in cmd.exe?


My System SpecsSystem Spec
Old 08-22-2007   #3 (permalink)
greatbarrier86


 
 

Re: Running WMI Query in without Powershell or VBS

wmic might be what i need.

The thing is, we are going to be running these queries directly on the
machine that is being queried. Thus, i think using get-wmiobject wont work.

"Brandon Shell" wrote:

> You don't need powershell to remotely query wmi
> user the -computername parameter for get-wmiobject
> PS> get-wmiobject Win32_Services -computername server1
>
> You can also use wmic
> http://www.microsoft.com/resources/d...n-us/wmic.mspx
>
> "greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
> news:36F1E9D2-53BA-4D10-B1DB-C8F02F9DE779@microsoft.com...
> > Hi,
> >
> > is it possible to call a windows API to get the wmi information? Some of
> > the
> > computers in my company do not have PowerShell on them so we need to come
> > up
> > with a better way. Also, can these queries be run in cmd.exe?

>
>

My System SpecsSystem Spec
Old 08-22-2007   #4 (permalink)
greatbarrier86


 
 

Re: Running WMI Query in without Powershell or VBS

using wmic works, but it outputs more than i actually want. if i do the
following
%PC_Model% = Wmic path win32_computersystem get model
it returns a header and the pc model. Since i want to write the model to a
file, is there a way to just spit back the model and not the header?

"greatbarrier86" wrote:

> wmic might be what i need.
>
> The thing is, we are going to be running these queries directly on the
> machine that is being queried. Thus, i think using get-wmiobject wont work.
>
> "Brandon Shell" wrote:
>
> > You don't need powershell to remotely query wmi
> > user the -computername parameter for get-wmiobject
> > PS> get-wmiobject Win32_Services -computername server1
> >
> > You can also use wmic
> > http://www.microsoft.com/resources/d...n-us/wmic.mspx
> >
> > "greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
> > news:36F1E9D2-53BA-4D10-B1DB-C8F02F9DE779@microsoft.com...
> > > Hi,
> > >
> > > is it possible to call a windows API to get the wmi information? Some of
> > > the
> > > computers in my company do not have PowerShell on them so we need to come
> > > up
> > > with a better way. Also, can these queries be run in cmd.exe?

> >
> >

My System SpecsSystem Spec
Old 08-22-2007   #5 (permalink)
RichS


 
 

Re: Running WMI Query in without Powershell or VBS

You can run PowerShell based WMI queries against a remote machine.
PowerShell does not need to be on the remote machine
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"greatbarrier86" wrote:

> wmic might be what i need.
>
> The thing is, we are going to be running these queries directly on the
> machine that is being queried. Thus, i think using get-wmiobject wont work.
>
> "Brandon Shell" wrote:
>
> > You don't need powershell to remotely query wmi
> > user the -computername parameter for get-wmiobject
> > PS> get-wmiobject Win32_Services -computername server1
> >
> > You can also use wmic
> > http://www.microsoft.com/resources/d...n-us/wmic.mspx
> >
> > "greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
> > news:36F1E9D2-53BA-4D10-B1DB-C8F02F9DE779@microsoft.com...
> > > Hi,
> > >
> > > is it possible to call a windows API to get the wmi information? Some of
> > > the
> > > computers in my company do not have PowerShell on them so we need to come
> > > up
> > > with a better way. Also, can these queries be run in cmd.exe?

> >
> >

My System SpecsSystem Spec
Old 08-23-2007   #6 (permalink)
Desmond Lee


 
 

Re: Running WMI Query in without Powershell or VBS

Standard PowerShell cmdlets do not have built-in remote capability. Using the
Get-WmiObject is the exception and as long as the application has a WMI
provider, such as Exchange Server 2003, you can remotely access it from your
administrative workstation with PowerShell (target remote system does not
need to have Powershell or .NETFramework).

For an example and more, see http://www.leedesmond.com/weblog/?p=177.

HTH.

--
http://www.leedesmond.com/weblog/



"greatbarrier86" wrote:

> using wmic works, but it outputs more than i actually want. if i do the
> following
> %PC_Model% = Wmic path win32_computersystem get model
> it returns a header and the pc model. Since i want to write the model to a
> file, is there a way to just spit back the model and not the header?
>
> "greatbarrier86" wrote:
>
> > wmic might be what i need.
> >
> > The thing is, we are going to be running these queries directly on the
> > machine that is being queried. Thus, i think using get-wmiobject wont work.
> >
> > "Brandon Shell" wrote:
> >
> > > You don't need powershell to remotely query wmi
> > > user the -computername parameter for get-wmiobject
> > > PS> get-wmiobject Win32_Services -computername server1
> > >
> > > You can also use wmic
> > > http://www.microsoft.com/resources/d...n-us/wmic.mspx
> > >
> > > "greatbarrier86" <greatbarrier86@discussions.microsoft.com> wrote in message
> > > news:36F1E9D2-53BA-4D10-B1DB-C8F02F9DE779@microsoft.com...
> > > > Hi,
> > > >
> > > > is it possible to call a windows API to get the wmi information? Some of
> > > > the
> > > > computers in my company do not have PowerShell on them so we need to come
> > > > up
> > > > with a better way. Also, can these queries be run in cmd.exe?
> > >
> > >

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Is there a way to query DNS from powershell? PowerShell
VBScript problem in running Stored Query VB Script
LDS query via powershell PowerShell
PerfMon PowerShell Query PowerShell
Query NT4 Domain from Powershell 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