Browse by Tags

All Tags » PowerShell and WMI (RSS)

WMICookbook: Read Routing Table

When we need to troubleshoot networking problems we will sometimes need to read the routing table on a machine. The routing table contains the information on the routes known to the network interfaces. This can be created automatically or manually . On...

WMI CookBook: WMI Presentation

As with other PowerShell objects there is a default format for the display of WMI objetcs. If we look at the NetworkAdapter class PS> Get-WmiObject -Class Win32_NetworkAdapter -Filter "DeviceId='11'" ServiceName     ...
Posted by RichardSiddaway | with no comments

WMI CookBook: Associators Pt I

WMI is a wonderful thing and like many people I have a love-hate relationship with it. It is incredibly powerful, and can take you deep into the system, but it is not easy to find your way. I have decided to spend some time digging into WMI and will document...

PowerShell WMI events

In my previous post ( http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!2598.entry   or http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!2598.entry ) I started to look at WMI events in PowerShell v2.  The win32_process...

PowerShell Eventing

This isn’t the latest sport added for the 2012 Olympics but a way to dig deeper into what is happening on your machine.  There is a continuous stream of events occurring on a computer – programs stop or start, files open or close etc etc.  Some...

System Up Time

The PowerShell team have just posted about obtaining system up time using a .NET class to convert the WMI date format to something thats readable http://blogs.msdn.com/powershell/archive/2009/08/12/get-systemuptime-and-working-with-the-wmi-date-format...

Creating a process

I've looked at creating a process before - using [WMIClass]. With CTP3 we have a few more options Start-Process -Filepath notepad.exe Invoke-WMIMethod -Class Win32_process -Name Create -ArgumentList notepad.exe Set-WMIinstance -Class Win32_process...
Posted by Richard's space
Filed under:

WMI Methods and Properties

Its odd how we discover things. I need to check the WMI classes for network adapters so used Get-WmiObject -List -Class *network* I intended to check out the data returned so used Get-WmiObject -List -Class win32_networkadapterconfiguration Notice I’ve...

Discovering WMI

One thing that seems to come up rather frequently on the newsgroups is what WMI class do I need to use to do X. The really confusing thing about WMI is knowing just what is available. I have done far more with WMI since discovering PowerShell than I ever...

W2KSG: Unique file names

Having seen how to back up our event logs we will need to do this periodically so we need to create unique file names for the backups. The obvious candidate is to base it on the date. Listing 12.7 $date = Get-Date Get-WmiObject -Class Win32_NTEventLogFile...

W2KSG: Triggered Event Log backups

We have seen how to backup and clear the event log. What about checking all of the event logs and doing a backup and clear if they have reached a certain size Listing 12.6 Get-WmiObject -Class Win32_NTEventLogFile | Where {$_.FileSize -gt 10MB} | Foreach...

W2KSG: Backup Event Log

We have see how to modify event log properties - lets look at backing them up and clearing out the entries. Preferably in that order. Listing 12.5 $log = Get-WmiObject -Class Win32_NTEventLogFile -Filter "LogFileName = 'Application'"...

W2KSG: Log Properties

Having seen how to view the log properties lets see how we can change them. One possibility is with WMI. Lets start by viewing the event logs Get-WmiObject -Class Win32_NTEventLogFile one thing to note is that the property with the log file name is LogFileName...

W2KSG: Page File

In theory Listing 10.19 Get-WmiObject -Class Win32_PageFile | Select CreationDate, Description, Drive, FileName, FileSize, InitialSize, InstallDate, MaximumSize,Name, Path should return information about the page file. On my Vista machine it doesn't...

W2KSG: File System Type

Skipping forward to Listing 10.16 Get-WmiObject -Class Win32_LogicalDisk | Select DeviceId, FileSystem We can quickly scan the disks for the file system. One interesting point from this is that offline files are given a file system type of CSC-CACHE Share...

W2KSG: Free Disk Space

Nope - not a 1960's political slogan. Previously we found out how to discover the logical disk drives on our machines. Having found them we want to know how much free space is available. Listing 10.6 $HardDisk = 3 Get-WmiObject -Class Win32_LogicalDisk...

W2KSG: Logical disks

Physical disks support partitions and logical disks. To discover the logical disks on a machine we would use Listing 10.3 Get-WmiObject -Class Win32_LogicalDisk | Select Compressed,Description, DeviceID, DriveType, FileSystem, FreeSpace, MediaType, Name...

W2KSG: Disk Partitions

After we have found the physical drives we need to think about the partitions on those drives Script Center Home > Microsoft Windows 2000 Scripting Guide > Scripting Solutions for System Administration > Disks and File Systems > Managing and...

W2KSG: Physical Disk Drive Properties

Lets stick with WMI and jump forward to chapter 10 where we will concentrate on disks and the file system Starting point is physical disks. The WMI class the logically named Win32_DiskDrive. If you want to see all properties use Get-WmiObject Win32_DiskDrive...

W2KSG: Startup Commands

What commands are run when your system starts? Probably more than you think. The information is held in a number of places in the registry and the startup folder of the start menu. We can access all of that with WMI Listing 8.20 Get-WmiObject win32_startupcommand...
More Posts Next page »