Hi,
The desktop settings of all the users at the endpoint can be viewed using this script.
For each user, the following desktop properties will be listed,
- BorderWidth : Defines the width of the borders around all windows with adjustable borders.
- Cursor Blink Rate : Length of time between successive cursor blinks.
- Drag Full Windows : Contents of a window are shown when a user moves the window.
- Icon Title Face Name : Font used for the names of the icons.
- Icon Title Size : Font size of the icon.
- Icon Title Wrap : Icon's title text wraps to the next line.
- Name : Name that identifies the current desktop profile.(Username)
- Pattern : Name of the pattern used as the background for the desktop.
- Screen Saver Active : Define whether Screen saver is active.
- Setting ID : Identifier by which the current object is known.
- Wallpaper : File name for the wallpaper design on the background of the desktop.
- Wallpaper Stretched : Define whether the Wallpaper is stretched to fill the entire screen or not
- Wallpaper Tiled : Define whether the Wallpaper is tiled or centered.
def display_desktop_setting():
import os
import ctypes
import re
class disable_file_system_redirection:
_disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
_revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
def __enter__(self):
self.old_value = ctypes.c_long()
self.success = self._disable(ctypes.byref(self.old_value))
def __exit__(self, type, value, traceback):
if self.success:
self._revert(self.old_value)
with disable_file_system_redirection():
script=r"""
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Desktop")
For Each objItem in colItems
Wscript.Echo "Border Width: " & objItem.BorderWidth
Wscript.Echo "Cursor Blink Rate: " & objItem.CursorBlinkRate
Wscript.Echo "Drag Full Windows: " & objItem.DragFullWindows
Wscript.Echo "Icon Title Face Name: " & objItem.IconTitleFaceName
Wscript.Echo "Icon Title Size: " & objItem.IconTitleSize
Wscript.Echo "Icon Title Wrap: " & objItem.IconTitleWrap
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Pattern: " & objItem.Pattern
Wscript.Echo "Screen Saver Active: " & objItem.ScreenSaverActive
Wscript.Echo "Setting ID: " & objItem.SettingID
Wscript.Echo "Wallpaper: " & objItem.Wallpaper
Wscript.Echo "Wallpaper Stretched: " & objItem.WallpaperStretched
Wscript.Echo "Wallpaper Tiled: " & objItem.WallpaperTiled
Next
}"""
path =os.environ['TEMP']
file = path+'\\'+'Desktop_setting_details.vbs'
fobj= open(file, "w");
fwrite=fobj.write(script);
fobj.close();
run=os.popen('cscript.exe '+file).read();
print("The Desktop setting of the device is
")
print run
try:
os.remove(file)
except OSError:
pass
return
display_desktop_setting()
SAMPLE OUTPUT: