Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI » Perl

Win32-Desktop - WMI Perl sample

The foundations for Manageability in Windows 2019/2016/2012/2008 and Windows 10/7/XP are Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself.

On this site, you can find many WMI samples.

The Win32_Desktop WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Win32-Desktop

Description

The Win32_Desktop WMI class represents the common characteristics of a user`s desktop. The properties of this class can be modified by the user to customize the desktop.

Example(s)

  use strict;
use Win32::OLE('in');

use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;

my @computers = ("DELL17");
foreach my $computer (@computers) {
   print "\n";
   print "==========================================\n";
   print "Computer: $computer\n";
   print "==========================================\n";

   my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
   my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Desktop", "WQL",
                  wbemFlagReturnImmediately | wbemFlagForwardOnly);

   foreach my $objItem (in $colItems) {
      print "BorderWidth: $objItem->{BorderWidth}\n";
      print "Caption: $objItem->{Caption}\n";
      print "CoolSwitch: $objItem->{CoolSwitch}\n";
      print "CursorBlinkRate: $objItem->{CursorBlinkRate}\n";
      print "Description: $objItem->{Description}\n";
      print "DragFullWindows: $objItem->{DragFullWindows}\n";
      print "GridGranularity: $objItem->{GridGranularity}\n";
      print "IconSpacing: $objItem->{IconSpacing}\n";
      print "IconTitleFaceName: $objItem->{IconTitleFaceName}\n";
      print "IconTitleSize: $objItem->{IconTitleSize}\n";
      print "IconTitleWrap: $objItem->{IconTitleWrap}\n";
      print "Name: $objItem->{Name}\n";
      print "Pattern: $objItem->{Pattern}\n";
      print "ScreenSaverActive: $objItem->{ScreenSaverActive}\n";
      print "ScreenSaverExecutable: $objItem->{ScreenSaverExecutable}\n";
      print "ScreenSaverSecure: $objItem->{ScreenSaverSecure}\n";
      print "ScreenSaverTimeout: $objItem->{ScreenSaverTimeout}\n";
      print "SettingID: $objItem->{SettingID}\n";
      print "Wallpaper: $objItem->{Wallpaper}\n";
      print "WallpaperStretched: $objItem->{WallpaperStretched}\n";
      print "WallpaperTiled: $objItem->{WallpaperTiled}\n";
      print "\n";
   }
}