User Tools

Site Tools


microsoft:scripting:misc

AutoIt

Voorbeelden

msiexec /i “dirnaam” /opties uitvoeren?

Probeer:

Run("msiexec /i installer.msi /qb!", "c:\directory")

Of:

Run("msiexec /i " & chr(34) & "c:\directory\installer.msi" & chr(34) & " /qb!", "c:\temp")

Notities

GUICtrlRead(ControlID) returned geen 0 bij geen invoer in GUICtrlCreateInput box, maar niks,

If GUICtrlRead($UNCDropBox) = "" Then 

werkt

If GUICtrlRead($UNCDropBox) = 0 Then 

werkt niet

VBScript

Voorbeeld

VBScript voor het opvragen van naam, ip adres en IPEnabled van alle netwerkkaarten op de pc met behulp van WMI.

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration",,48)

For Each objItem in colItems

	Wscript.Echo "Caption: " & objItem.Caption

        For Each strAddress in objItem.IPAddress
            Wscript.Echo strAddress
        Next

	Wscript.Echo "IPEnabled: " & objItem.IPEnabled

next

Bron:Hip, Hip, Array - Retrieving Multi-Valued WMI Properties from Windows PowerShell

WMI

Links

Blogposts/Articles

Tools

Voorbeeld script

WMI-filter voor GPO.

Root\CimV2; Select * from Win32_OperatingSystem where Caption = "Microsoft Windows XP Professional"

Bron:How can I restrict the application of Group Policy Object (GPOs) depending on the client machine's OS?

Volgende werkt jammergenoeg niet:

SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPAddress LIKE '%192.168%'

Reden: “LIKE can't be used for “IPAddress”, because this property is an array and arrays are not supported by WQL.” Bron:Help with WQL query

WMI-Filter voor Windows Server 2008

select * from Win32_OperatingSystem where Caption like '%2008%'

Filteren op XP en SP niveau

XP Service Pack 1 en 0:

Query = "Select * from WIN32_OperatingSystem where ServicePackMajorVersion<=1 and Version='5.1.2600'";
QueryLanguage = "WQL";
TargetNameSpace = "root\\CIMV2";

XP Service Pack 2, 3 en hoger:

Query = "Select * from WIN32_OperatingSystem where ServicePackMajorVersion>=2 and Version='5.1.2600'";
QueryLanguage = "WQL";
TargetNameSpace = "root\\CIMV2";

XP Service Pack 1:

Query = "Select * from WIN32_OperatingSystem where ServicePackMajorVersion=1 and Version='5.1.2600'";
QueryLanguage = "WQL";
TargetNameSpace = "root\\CIMV2";

XP Service Pack 2:

Query = "Select * from WIN32_OperatingSystem where ServicePackMajorVersion=2 and Version='5.1.2600'";
QueryLanguage = "WQL";
TargetNameSpace = "root\\CIMV2";

XP Service Pack 3:

Query = "Select * from WIN32_OperatingSystem where ServicePackMajorVersion=3 and Version='5.1.2600'";
QueryLanguage = "WQL";
TargetNameSpace = "root\\CIMV2";

Bron:SBS 2003 Group Policy Help

OS Captions

Windows XP (SP3)

Microsoft Windows XP Professional

Windows Server 2003 (x64):

Microsoft(R) Windows(R) Server 2003 Standard x64 Edition
Microsoft(R) Windows(R) Server 2003 Enterprise x64 Edition

Windows Server 2008 (x86 en x64):

Microsoft® Windows Server® 2008 Standard
Microsoftr Windows Serverr 2008 Enterprise

Bron:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each objOS in colOS

	WScript.Echo objOS.Caption

Next

Set colOS = Nothing
Set colSystem = Nothing
Set objWMIService = Nothing

Filteren op het geïnstalleerd zijn van twee applicaties

Zet tweemaal een controle op een bestand in het filter. Beide controles moeten true zijn om de hele controle op true te laten uitkomen:

instance of MSFT_Rule
{
	Query = "Select * From CIM_Datafile Where Name = 'C:\\\\Program Files\\\\Microsoft Office\\\\Office11\\\\winword.exe'";
	QueryLanguage = "WQL";
	TargetNameSpace = "root\\CIMv2";
}, 
instance of MSFT_Rule
{
	Query = "Select * From CIM_Datafile Where Name = 'C:\\\\Program Files\\\\Altiris\\\\Software Virtualization Agent\\\\svscmd.exe'";
	QueryLanguage = "WQL";
	TargetNameSpace = "root\\CIMv2";
}
microsoft/scripting/misc.txt · Last modified: 2013/10/17 20:51 by bas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki