Search Results

Search found 9 results on 1 pages for 'wql'.

Page 1/1 | 1 

  • When querying the Win32_NTLogEvent Class from WMI with WQL is the TimeGenerated property based on Lo

    - by jpmcclung
    I am writing a C# windows service that is doing some churning through the eventlog on a few domain controllers. Some of them are Windows Server 2003 and some are Windows Server 2008. Upon the service stopping I am attempting to resume where I left off in the logs. In order to do this instead of SELECT * FROM Win32_NTLogEvent WHERE --criteria for events I am looking for I am doing SELECT * FROM Win32_NTLogEvent WHERE TimeGenerated = --some date AND --criteria for events I am looking for At one point I was convinced that the TimeGenerated field was in the local time of the server but now it seems that the Windows 2008 Servers are using GMT to record that time. Can anyone shed some light on if this is a real different between the way the two operating systems function or is this a configuration problem?

    Read the article

  • How to get a count of ManagementObjects (WMI results) without enumerating through the collection in

    - by Mark
    When querying for large ammount of data through WMI (say the windows events log Win32_NTLogEvent) it is very useful to know what kind of numbers you are getting yourself into before downloading all the content. Is there a way two do this? From what i know there is no "Select Count(*) FROM Win32_NTLogEvent" in WQL. From what i know the Count property of the ManagementObjectCollection actually enumerates through all the results whether you have the Rewindable property set to true or false. If it cannot be done in .NET, can it be done by directly using the underlying IWbem objects Thanks

    Read the article

  • I have a SID of a user account, and I want the SIDs of the groups it belongs to. (C#)

    - by JCCyC
    This has to be obtained from a remote machine. The following query works not for SIDs, but for group and account names. "SELECT GroupComponent FROM Win32_GroupUser WHERE PartComponent = \"Win32_UserAccount.Domain='" + accountDomain + "',Name='" + accountName + "'\"" The Win32_Group objects it returns come in the forms of strings, and they only have domain and name (even though Win32_Group has a SID property). I have this sinking feeling I'll have to: Turn the SID into an account name by querying Win32_SID; Perform the query above; Turn each of the resulting group names into SIDs by querying Win32_Group. PLEASE tell me there's a better way.

    Read the article

  • WMI, WQL, Management Event Objects, MEWatcher Etc, Tutorials (C#)???

    - by IbrarMumtaz
    Anybody got any any tutorials that cover these subjects ... the official MS 70-536 book covers this but I don't want to take any chances as I want additional reading materials problem is, its proving difficult to find anything on it. It's a fairly big subject so am hoping somone on here as here as got some good reading materials on that cover these subjects. At this very moment in time, im reading this; Tutorial01 Its not much, but its a good starting point. I'm not a big fan MSDN and the way its structured and layout, I mainly use it for framework related questions like classes and interfaces and etc. WHen it comes to tutorials, i prefer thrid party websites. Lastly, this extra reading which I am asking for is really revision for the 70-536 exam. TIA. Ibrar

    Read the article

  • Zenoss need to get freespace threshold and alerts on windows "mount points"

    - by agilenoob
    I have a WMI query that will give me all the data I need to do this but I can't figure out how to get this working in Zenoss. I know I need to set data points and a threshold, and optionaly a graph. The problem is examples of how to do this with WMI are few and very confusing. Could anyone atleast point me to documention on how to do this? WMI Query(WQL): "SELECT Caption, Capacity, Freespace FROM Win32_Volume WHERE DriveLetter IS NULL"

    Read the article

  • Find only physical network adapters with WMI Win32_NetworkAdapter class

    - by Mladen Prajdic
    WMI is Windows Management Instrumentation infrastructure for managing data and machines. We can access it by using WQL (WMI querying language or SQL for WMI). One thing to remember from the WQL link is that it doesn't support ORDER BY. This means that when you do SELECT * FROM wmiObject, the returned order of the objects is not guaranteed. It can return adapters in different order based on logged-in user, permissions of that user, etc… This is not documented anywhere that I've looked and is derived just from my observations. To get network adapters we have to query the Win32_NetworkAdapter class. This returns us all network adapters that windows detect, real and virtual ones, however it only supplies IPv4 data. I've tried various methods of combining properties that are common on all systems since Windows XP. The first thing to do to remove all virtual adapters (like tunneling, WAN miniports, etc…) created by Microsoft. We do this by adding WHERE Manufacturer!='Microsoft' to our WMI query. This greatly narrows the number of adapters we have to work with. Just on my machine it went from 20 adapters to 5. What was left were one real physical Realtek LAN adapter, 2 virtual adapters installed by VMware and 2 virtual adapters installed by VirtualBox. If you read the Win32_NetworkAdapter help page you'd notice that there's an AdapterType that enumerates various adapter types like LAN or Wireless and AdapterTypeID that gives you the same information as AdapterType only in integer form. The dirty little secret is that these 2 properties don't work. They are both hardcoded, AdapterTypeID to "0" and AdapterType to "Ethernet 802.3". The only exceptions I've seen so far are adapters that have no values at all for the two properties, "RAS Async Adapter" that has values of AdapterType = "Wide Area Network" and AdapterTypeID = "3" and various tunneling adapters that have values of AdapterType = "Tunnel" and AdapterTypeID = "15". In the help docs there isn't even a value for 15. So this property was of no help. Next property to give hope is NetConnectionId. This is the name of the network connection as it appears in the Control Panel -> Network Connections. Problem is this value is also localized into various languages and can have different names for different connection. So both of these properties don't help and we haven't even started talking about eliminating virtual adapters. Same as the previous one this property was also of no help. Next two properties I checked were ConfigManagerErrorCode and NetConnectionStatus in hopes of finding disabled and disconnected adapters. If an adapter is enabled but disconnected the ConfigManagerErrorCode = 0 with different NetConnectionStatus. If the adapter is disabled it reports ConfigManagerErrorCode = 22. This looked like a win by using (ConfigManagerErrorCode=0 or ConfigManagerErrorCode=22) in our condition. This way we get enabled (connected and disconnected adapters). Problem with all of the above properties is that none of them filter out the virtual adapters installed by virtualization software like VMware and VirtualBox. The last property to give hope is PNPDeviceID. There's an interesting observation about physical and virtual adapters with this property. Every virtual adapter PNPDeviceID starts with "ROOT\". Even VMware and VirtualBox ones. There were some really, really old physical adapters that had PNPDeviceID starting with "ROOT\" but those were in pre win XP era AFAIK. Since my minimum system to check was Windows XP SP2 I didn't have to worry about those. The only virtual adapter I've seen to not have PNPDeviceID start with "ROOT\" is the RAS Async Adapter for Wide Area Network. But because it is made by Microsoft we've eliminated it with the first condition for the manufacturer. Using the PNPDeviceID has so far proven to be really effective and I've tested it on over 20 different computers of various configurations from Windows XP laptops with wireless and bluetooth cards to virtualized Windows 2008 R2 servers. So far it always worked as expected. I will appreciate you letting me know if you find a configuration where it doesn't work. Let's see some C# code how to do this: ManagementObjectSearcher mos = null;// WHERE Manufacturer!='Microsoft' removes all of the // Microsoft provided virtual adapters like tunneling, miniports, and Wide Area Network adapters.mos = new ManagementObjectSearcher(@"SELECT * FROM Win32_NetworkAdapter WHERE Manufacturer != 'Microsoft'");// Trying the ConfigManagerErrorCode and NetConnectionStatus variations // proved to still not be enough and it returns adapters installed by // the virtualization software like VMWare and VirtualBox// ConfigManagerErrorCode = 0 -> Device is working properly. This covers enabled and/or disconnected devices// ConfigManagerErrorCode = 22 AND NetConnectionStatus = 0 -> Device is disabled and Disconnected. // Some virtual devices report ConfigManagerErrorCode = 22 (disabled) and some other NetConnectionStatus than 0mos = new ManagementObjectSearcher(@"SELECT * FROM Win32_NetworkAdapter WHERE Manufacturer != 'Microsoft' AND (ConfigManagerErrorCode = 0 OR (ConfigManagerErrorCode = 22 AND NetConnectionStatus = 0))");// Final solution with filtering on the Manufacturer and PNPDeviceID not starting with "ROOT\"// Physical devices have PNPDeviceID starting with "PCI\" or something else besides "ROOT\"mos = new ManagementObjectSearcher(@"SELECT * FROM Win32_NetworkAdapter WHERE Manufacturer != 'Microsoft' AND NOT PNPDeviceID LIKE 'ROOT\\%'");// Get the physical adapters and sort them by their index. // This is needed because they're not sorted by defaultIList<ManagementObject> managementObjectList = mos.Get() .Cast<ManagementObject>() .OrderBy(p => Convert.ToUInt32(p.Properties["Index"].Value)) .ToList();// Let's just show all the properties for all physical adapters.foreach (ManagementObject mo in managementObjectList){ foreach (PropertyData pd in mo.Properties) Console.WriteLine(pd.Name + ": " + (pd.Value ?? "N/A"));}   That's it. Hope this helps you in some way.

    Read the article

  • WMI/VBS/HTML System Information Script

    - by Methical
    Hey guys; havin' a problem with this code here; can't seem to work out whats goin' wrong with it. All other variables seem to print fine in the HTML ouput; but I get an error that relates to the cputype variable. I get the following error C:\Users\Methical\Desktop\sysinfo.vbs(235,1) Microsoft VBScript runtime error: Invalid procedure call or argument I think it has somethin' to do with this line here fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>CPU</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & cputype & "</i></td></tr>" If i delete this line; the script compiles and outputs with no errors. Here is the full code below Dim strComputer, objWMIService, propValue, objItem Dim strUserName, strPassword, colItems, SWBemlocator ' This section querries for the workstation to be scanned. UserName = "" Password = "" strComputer = "127.1.1.1" ImgDir = "C:\Scripts\images\" 'Sets up the connections and opjects to be used throughout the script. Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = SWBemlocator.ConnectServer(,"root\CIMV2",strUserName,strPassword) 'This determines the current date and time of the PC being scanned. Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LocalTime", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem in colItems If objItem.Minute < 10 Then theMinutes = "0" & objItem.Minute Else theMinutes = objItem.Minute End If If objItem.Second < 10 Then theSeconds = "0" & objItem.Second Else theSeconds = objItem.Second End If DateTime = objItem.Month & "/" & objItem.Day & "/" & objItem.Year & " - " & objItem.Hour & ":" & theMinutes & ":" & theSeconds Next 'Gets some ingomation about the Operating System including Service Pack level. Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48) For Each objItem in colItems WKID = objItem.CSName WKOS = objItem.Caption CSD = objItem.CSDVersion Architecture = objItem.OSArchitecture SysDir = objItem.SystemDirectory SysDrive = objItem.SystemDrive WinDir = objItem.WindowsDirectory ServicePack = objItem.ServicePackMajorVersion & "." & objItem.ServicePackMinorVersion Next 'This section returns the Time Zone Set colItems = objWMIService.ExecQuery("Select * from Win32_TimeZone") For Each objItem in colItems Zone = objItem.Description Next 'This section displays the Shadow Storage information Set colItems = objWMIService.ExecQuery("Select * from Win32_ShadowStorage") For Each objItem in colItems Allocated = int((objItem.AllocatedSpace/1024)/1024+1) UsedSpace = int((objItem.UsedSpace/1024)/1024+1) MaxSpace = int((objItem.MaxSpace/1024)/1024+1) Next 'This section returns the InstallDate of the OS Set objSWbemDateTime = _ CreateObject("WbemScripting.SWbemDateTime") Set colOperatingSystems = _ objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem _ in colOperatingSystems objSWbemDateTime.Value = _ objOperatingSystem.InstallDate InstallDate = _ objSWbemDateTime.GetVarDate(False) Next 'This section returns the Video card and current resolution. Set colItems = objWMIService.ExecQuery("Select * from Win32_DisplayConfiguration",,48) For Each objItem in colItems VideoCard = objItem.DeviceName Resolution = objItem.PelsWidth & " x " & objItem.PelsHeight & " x " & objItem.BitsPerPel & " bits" Next 'This section returns the Video card memory. Set objWMIService = GetObject("winmgmts:root\cimv2") Set colItems = objWMIService.ExecQuery ("Select * from Win32_VideoController") For Each objItem in colItems VideoMemory = objItem.AdapterRAM/1024/1024 Next 'This returns various system information including current logged on user, domain, memory, manufacture and model. Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48) For Each objItem in colItems UserName = objItem.UserName Domain = objItem.Domain TotalMemory = int((objItem.TotalPhysicalMemory/1024)/1024+1) Manufacturer = objItem.Manufacturer Model = objItem.Model SysType = objItem.SystemType Next 'This determines the total hard drive space and free hard drive space. Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where Name='C:'",,48) For Each objItem in colItems FreeHDSpace = Fix(((objItem.FreeSpace/1024)/1024)/1024) TotalHDSpace = Fix(((objItem.Size/1024)/1024)/1024) Next 'This section returns the default printer and printer port. Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Printer where Default=True", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem in colItems Printer = objItem.Name PortName = objItem.PortName Next 'This returns the CPU information. Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem in colItems CPUDesc = LTrim(objItem.Name) Next '// CPU Info For each objCPU in GetObject("winmgmts:{impersonationLevel=impersonate}\\" & strComputer & "\root\cimv2").InstancesOf("Win32_Processor") Select Case objCPU.Family Case 2 cputype = "Unknown" Case 11 cputype = "Pentium brand" Case 12 cputype = "Pentium Pro" Case 13 cputype = "Pentium II" Case 14 cputype = "Pentium processor with MMX technology" Case 15 cputype = "Celeron " Case 16 cputype = "Pentium II Xeon" Case 17 cputype = "Pentium III" Case 28 cputype = "AMD Athlon Processor Family" Case 29 cputype = "AMD Duron Processor" Case 30 cputype = "AMD2900 Family" Case 31 cputype = "K6-2+" Case 130 cputype = "Itanium Processor" Case 176 cputype = "Pentium III Xeon" Case 177 cputype = "Pentium III Processor with Intel SpeedStep Technology" Case 178 cputype = "Pentium 4" Case 179 cputype = "Intel Xeon" Case 181 cputype = "Intel Xeon processor MP" Case 182 cputype = "AMD AthlonXP Family" Case 183 cputype = "AMD AthlonMP Family" Case 184 cputype = "Intel Itanium 2" Case 185 cputype = "AMD Opteron? Family" End Select Next 'This returns the current uptime (time since last reboot) of the system. Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem") For Each objOS in colOperatingSystems dtmBootup = objOS.LastBootUpTime dtmLastBootupTime = WMIDateStringToDate(dtmBootup) dtmSystemUptime = DateDiff("h", dtmLastBootUpTime, Now) Uptime = dtmSystemUptime Next Function WMIDateStringToDate(dtmBootup) WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) & " " & Mid (dtmBootup, 9, 2) & ":" & Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2)) End Function dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") ' -- The heart of the create file script ----------------------- ' -- Creates the file using the value of strFile on Line 11 ' -------------------------------------------------------------- Set fileOutput = objFSO.CreateTextFile( "x.html", true ) 'Set fileOutput = objExplorer.Document 'This is the code for the web page to be displayed. fileOutput.WriteLine "<html>" fileOutput.WriteLine " <head>" fileOutput.WriteLine " <title>System Information for '" & WKID & "' </title>" fileOutput.WriteLine " </head>" fileOutput.WriteLine " <body bgcolor='#FFFFFF' text='#000000' link='#0000FF' vlink='000099' alink='#00FF00'>" fileOutput.WriteLine " <center>" fileOutput.WriteLine " <h1>System Information for " & WKID & "</h1>" fileOutput.WriteLine " <table border='0' cellspacing='1' cellpadding='1' width='95%'>" fileOutput.WriteLine " <tr><td background='" & ImgDir & "blue_spacer.gif'>" fileOutput.WriteLine " <table border='0' cellspacing='0' cellpadding='0' width='100%'>" fileOutput.WriteLine " <tr><td>" fileOutput.WriteLine " <table border='0' cellspacing='0' cellpadding='0' width='100%'>" fileOutput.WriteLine " <tr>" fileOutput.WriteLine " <td width='5%' align='left' valign='middle' background='" & ImgDir & "blue_spacer.gif'><img src='" & ImgDir & "write.gif'></td>" fileOutput.WriteLine " <td width='95%' align='left' valign='middle' background='" & ImgDir & "blue_spacer.gif'> <font color='#FFFFFF' size='5'>WKInfo - </font><font color='#FFFFFF' size='3'>General information on the Workstation.</font></td>" fileOutput.WriteLine " </tr>" fileOutput.WriteLine " <tr><td colspan='2' bgcolor='#FFFFFF'>" fileOutput.WriteLine " <TABLE width='100%' cellspacing='0' cellpadding='2' border='1' bordercolor='#c0c0c0' bordercolordark='#ffffff' bordercolorlight='#c0c0c0'>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD align='center' bgcolor='#d0d0d0' colspan='2'><b><h3>Date and Time</h3></b></TD></TR>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Date/Time</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & DateTime & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>System Uptime</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & Uptime & " hours</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Time Zone</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & Zone & " </i></td></tr>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD align='center' bgcolor='#d0d0d0' colspan='2'><b><h3>General Computer Information</h3></b></TD></TR>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Manufacturer</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & Manufacturer & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Model</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & Model & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>System Based</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & SysType & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Operating System</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & WKOS & " " & CSD & " " & Architecture & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Operating System Install Date</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & InstallDate & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>UserName</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & UserName & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Workstation Name</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & WKID & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Domain</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & Domain & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>System Drive</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & SysDrive & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>System Directory</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & SysDir & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Windows Directory</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & WinDir & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>ShadowStorage Allocated Space</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & Allocated & " MB</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>ShadowStorage Used Space</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & UsedSpace & " MB</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>ShadowStorage Max Space</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & MaxSpace & " MB</i></td></tr>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD align='center' bgcolor='#d0d0d0' colspan='2'><b><h3>General Hardware Information</h3></b></TD></TR>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>CPU</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & cputype & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Memory</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & TotalMemory & " MB</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Total HDD Space</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & TotalHDSpace & " GB</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Free HDD Space</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & FreeHDSpace & " GB</i></td></tr>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD align='center' bgcolor='#d0d0d0' colspan='2'><b><h3>General Video Card Information</h3></b></TD></TR>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Video Card</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & VideoCard & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Resolution</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & Resolution & "</i></td></tr>" fileOutput.WriteLine " <TR><TD width='30%' align='left' bgcolor='#e0e0e0'>Memory</TD><td width='70%' bgcolor=#f0f0f0 align=left><i>" & VideoMemory & " MB</i></td></tr>" 'This section lists all the current services and their status. fileOutput.WriteLine " <TR><TD align='center' bgcolor='#d0d0d0' colspan='2'><b><h3>Current Service Information</h3></b></TD></TR>" fileOutput.WriteLine " <tr><td colspan='2' bgcolor='#f0f0f0'>" fileOutput.WriteLine " <TABLE width='100%' cellspacing='0' cellpadding='2' border='1' bordercolor='#c0c0c0' bordercolordark='#ffffff' bordercolorlight='#c0c0c0'>" fileOutput.WriteLine " <TR><TD width='70%' align='center' bgcolor='#e0e0e0'><b>Service Name</b></td><TD width='30%' align='center' bgcolor='#e0e0e0'><b>Service State</b></td><tr>" Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service") For Each objService in colRunningServices fileOutput.WriteLine " <TR><TD align='left' bgcolor='#f0f0f0'>" & objService.DisplayName & "</TD><td bgcolor=#f0f0f0 align=center><i>" & objService.State & "</i></td></tr>" wscript.echo " <TR><TD align='left' bgcolor='#f0f0f0'>" & objService.DisplayName & "</TD><td bgcolor=#f0f0f0 align=center><i>" & objService.State & "</i></td></tr>" Next fileOutput.WriteLine " </table>" fileOutput.WriteLine " </td></tr>" 'This section lists all the current running processes and some information. fileOutput.WriteLine " <TR><TD align='center' bgcolor='#d0d0d0' colspan='2'><b><h3>Current Process Information</h3></b></TD></TR>" fileOutput.WriteLine " <tr><td colspan='2' bgcolor='#f0f0f0'>" fileOutput.WriteLine " <TABLE width='100%' cellspacing='0' cellpadding='2' border='1' bordercolor='#c0c0c0' bordercolordark='#ffffff' bordercolorlight='#c0c0c0'>" fileOutput.WriteLine " <TR><TD width='10%' align='center' bgcolor='#e0e0e0'><b>PID</b></td><TD width='35%' align='center' bgcolor='#e0e0e0'><b>Process Name</b></td><TD width='40%' align='center' bgcolor='#e0e0e0'><b>Owner</b></td><TD width='15%' align='center' bgcolor='#e0e0e0'><b>Memory</b></td></tr>" Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process") For Each objProcess in colProcessList colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain) fileOutput.WriteLine " <TR><TD align='center' bgcolor='#f0f0f0'>" & objProcess.Handle & "</td><TD align='center' bgcolor='#f0f0f0'>" & objProcess.Name & "</td><TD align='center' bgcolor='#f0f0f0'>" & strUserDomain & "\" & strNameOfUser & "</td><TD align='center' bgcolor='#f0f0f0'>" & objProcess.WorkingSetSize/1024 & " kb</td><tr>" Next fileOutput.WriteLine " </table>" fileOutput.WriteLine " </td></tr>" 'This section lists all the currently installed software on the machine. fileOutput.WriteLine " <TR><TD align='center' bgcolor='#d0d0d0' colspan='2'><b><i>Installed Software</i></b></TD></TR>" fileOutput.WriteLine " <tr><td colspan='2' bgcolor='#f0f0f0'>" Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product") For Each objSoftware in colSoftware fileOutput.WriteLine" <TABLE width='100%' cellspacing='0' cellpadding='2' border='1' bordercolor='#c0c0c0' bordercolordark='#ffffff' bordercolorlight='#c0c0c0'>" fileOutput.WriteLine" <tr><td width=30% align=center bgcolor='#e0e0e0'><b>Name</b></td><td width=30% align=center bgcolor='#e0e0e0'><b>Vendor</b></td><td width=30% align=center bgcolor='#e0e0e0'><b>Version</b></td></tr>" fileOutput.WriteLine" <tr><td align=center bgcolor=#f0f0f0>" & objSoftware.Name & "</td><td align=center bgcolor=#f0f0f0>" & objSoftware.Vendor & "</td><td align=center bgcolor=#f0f0f0>" & objSoftware.Version & "</td></tr>" fileOutput.WriteLine" <tr height=2><td height=10 align=center bgcolor=midnightblue colspan=3></td></tr>" fileOutput.WriteLine" </table>" Next fileOutput.WriteLine " </td></tr>" fileOutput.WriteLine " </table>" fileOutput.WriteLine " </td></tr>" fileOutput.WriteLine " </table>" fileOutput.WriteLine " </td></tr>" fileOutput.WriteLine " </table>" fileOutput.WriteLine " </td></tr>" fileOutput.WriteLine " </table>" fileOutput.WriteLine " <p><small></small></p>" fileOutput.WriteLine " </center>" fileOutput.WriteLine " </body>" fileOutput.WriteLine "<html>" fileOutput.close WScript.Quit

    Read the article

  • How to get Drive Letter Using WMI

    - by new
    i get the vid and pid of the usb devices plugged into my system using WMI. Now i want to get the drive letter corresponding to the device vid and pid i retrievd. code hres = pSvc->ExecQuery( bstr_t("WQL"), bstr_t("SELECT * FROM Win32_USBControllerDevice"), WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator); if (FAILED(pclsObj->Get(L"Dependent", 0, &vtProp, 0, 0))) { cout<<"The specified property is not found."<<endl; } else { wcout <<vtProp.bstrVal << endl; } i get like below \NJ96\root\cimv2:Win32_PnPEntity.DeviceID="USB\VID_1A8D&PID_1000\35809402 0874450" how can i map DRIVE LETTER to my above output using the WMI please help me out

    Read the article

  • How do I use WMI with Delphi without drastically increasing the application's file size?

    - by Mick
    I am using Delphi 2010, and when I created a console application that prints "Hello World", it takes 111 kb. If I want to query WMI with Delphi, I add WBEMScripting_TLB, ActiveX, and Variants units to my project. If I perform a simple WMI query, my executable size jumps to 810 kb. I Is there anyway to query WMI without such a large addition to the size of the file? Forgive my ignorance, but why do I not have this issue with C++? Here is my code: program WMITest; {$APPTYPE CONSOLE} uses SysUtils, WBEMScripting_TLB, ActiveX, Variants; function GetWMIstring(wmiHost, root, wmiClass, wmiProperty: string): string; var Services: ISWbemServices; SObject: ISWbemObject; ObjSet: ISWbemObjectSet; SProp: ISWbemProperty; Enum: IEnumVariant; Value: Cardinal; TempObj: OLEVariant; loc: TSWbemLocator; SN: string; i: integer; begin Result := ''; i := 0; try loc := TSWbemLocator.Create(nil); Services := Loc.ConnectServer(wmiHost, root {'root\cimv2'}, '', '', '', '', 0, nil); ObjSet := Services.ExecQuery('SELECT * FROM ' + wmiClass, 'WQL', wbemFlagReturnImmediately and wbemFlagForwardOnly, nil); Enum := (ObjSet._NewEnum) as IEnumVariant; if not VarIsNull(Enum) then try while Enum.Next(1, TempObj, Value) = S_OK do begin try SObject := IUnknown(TempObj) as ISWBemObject; except SObject := nil; end; TempObj := Unassigned; if SObject <> nil then begin SProp := SObject.Properties_.Item(wmiProperty, 0); SN := SProp.Get_Value; if not VarIsNull(SN) then begin if varisarray(SN) then begin for i := vararraylowbound(SN, 1) to vararrayhighbound(SN, 1) do result := vartostr(SN[i]); end else Result := SN; Break; end; end; end; SProp := nil; except Result := ''; end else Result := ''; Enum := nil; Services := nil; ObjSet := nil; except on E: Exception do Result := e.message; end; end; begin try WriteLn('hello world'); WriteLn(GetWMIstring('.', 'root\CIMV2', 'Win32_OperatingSystem', 'Caption')); WriteLn('done'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end.

    Read the article

1