yosvanyisel Posted April 15, 2015 Share Posted April 15, 2015 please could help me. I need to get the domain name of a remote computer using the principle of your example using user credentials. similar to this.the problem is that the example I have returned empty string me when I enter the name of a network computerFunc DomainComputerBelongs($strComputer = "localhost"); Generated by AutoIt Scriptomatic$Domain = ''$wbemFlagReturnImmediately = 0x10$wbemFlagForwardOnly = 0x20$objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2")If Not IsObj($objWMIService) Then Return SetError(1, 0, '')$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _$wbemFlagReturnImmediately + $wbemFlagForwardOnly)If IsObj($colItems) thenFor $objItem In $colItems$Domain = $objItem.DomainNextEndifReturn $DomainEndFunc Link to comment Share on other sites More sharing options...
Solution jguinch Posted April 15, 2015 Solution Share Posted April 15, 2015 You can specify the login/password with something like this : $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") $objWMIService = $objSWbemLocator.ConnectServer($strComputer,"root\CIMV2",$strUser, $strPassword) yosvanyisel 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
yosvanyisel Posted April 15, 2015 Author Share Posted April 15, 2015 PERFECT THANKSSSSS !!!!!!!!!!!!!!!! Link to comment Share on other sites More sharing options...
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