WMI Memory Script
I wrote this page to extend you scripting horizons. My point is that in addition to logon scripts, VBScripts can be used other areas such as server configurations. Since I wrote this page, I created a whole section on WMI.
What will this script do?
Show you how much RAM that your machine has. Try this simple script and get an idea of the power and performance of WMI and VBScript.
Try this simple script and get an idea of the power and performance of WMI and VBScript.
strServer = "Lucy3"
Set wbemServices = GetObject("winmgmts:\\" & strServer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
For Each wbemObject In wbemObjectSet
WScript.Echo "Physical Memory (kb): " & wbemObject.TotalPhysicalMemory
Next
Copy and paste the example above into notepad.exe
IMPORTANT change strServer = "Lucy3" to the name of one of the computers on your network.
Save the script with a .vbs extension, and double click the file to test it.
Once it works apply it to your users through a Group Policy.
°
Try another simple script and get an idea of the power and performance of WMI and VBScript.
Here is a whole section on WMI VBScripts.
What this script will do?
The purpose of this script is to enumerate all the Local Groups a user is a member of. Note change guyt to the name of your user.
strComputer = "."
Set colGroups = GetObject("WinNT://" & strComputer & "")
colGroups.Filter = Array("group")
For Each objGroup In colGroups
For Each objUser in objGroup.Members
If objUser.name = "guyt" Then
Wscript.Echo objGroup.Name
End If
Next
Next
WMI (Windows Management Instrumentation)
WMI is one of Microsoft’s best-kept secrets. WMI is Microsoft’s core management enabling technology for Windows 2003 and .NET. For once Microsoft are using an industry standard DMTF (Distributed Management Task Force). WMI is the instrumentation by which Windows resources can be monitored, managed, and configured.
Windows Scripting
Windows and .NET have two built-in scripting engines, Microsoft JScript and Visual Basic Scripting Edition. Using Windows Script Host you can write scripts to manage and automate your servers and networks:
Windows .NET Server, XP Professional, and Windows 2003 (and Pro) systems management. Write scripts to retrieve performance data, security, event logs, file systems, printers, processes, registry settings, and other operating system settings.
Network management. Create WMI-based scripts to manage DHCP, DNS, and SNMP-enabled devices.
Real-time health monitoring. Using WMI event subscriptions, you can write scripts to monitor and respond to event log entries as they occur, file system and registry modifications, and other real-time operating system changes. Conceptually, WMI event subscriptions and notifications are to WMI what SNMP traps are in the SNMP world.
Windows .NET Application management. Write scripts to manage, Internet Information Server, Exchange Server, and SQL Server.