Valnurat Posted February 26, 2018 Posted February 26, 2018 I have this in powershell: $computer = "computername" (Get-WmiObject -Namespace "root\SMS\site_PEN" -ComputerName "servername" -Class SMS_G_System_COMPUTER_SYSTEM -Filter "Name='$computer'")|select * Is it possible to do this in AutoIT? Yours sincerely Kenneth.
iamtheky Posted February 26, 2018 Posted February 26, 2018 you could (search 'powershell and WMI'), but if its just a WMI query I would run that directly rather than wait for powershell to tell me. Look up "scriptomatic" for all the fun you can do with WMI directly. This thread also has a few powershell CIM-Instance examples: ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Subz Posted February 27, 2018 Posted February 27, 2018 I normally use something like: _Get_ComputerObj(@ComputerName) Func _Get_ComputerObj($_sComputerName) Local $sServerName = "SCCM Server", $sSiteCode = "3 Character Site Code" Local $oSWBEMLoc = ObjCreate("WbemScripting.SWbemLocator") Local $oConnectSrv = $oSWBEMLoc.ConnectServer($sServerName, "root\SMS\site_" & $sSiteCode) $sQuery = "SELECT * FROM SMS_G_System_COMPUTER_SYSTEM Where Name='" & $_sComputerName & "'" $oComputers = $oConnectSrv.ExecQuery($sQuery) For $oComputer In $oComputers MsgBox(32, "", "Computer Name: " & $oComputer.Name & @CRLF & "ResourceId: " & $oComputer.ResourceId) Next EndFunc
Valnurat Posted March 2, 2018 Author Posted March 2, 2018 Great. Will try that out. Yours sincerely Kenneth.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now