jdelaney Posted October 30, 2012 Posted October 30, 2012 I'm trying to find the user of a mapped drive, any ideas? If not, I'll remove, and then add with the user I expect. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
hannes08 Posted October 30, 2012 Posted October 30, 2012 You could get the outputs of "net use" and parse it. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
jdelaney Posted October 30, 2012 Author Posted October 30, 2012 that only includes local name, remote name, resource type, status, opens, connections...unless i'm missing something IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
hannes08 Posted October 30, 2012 Posted October 30, 2012 Hm. You're right. That happens when I post before I try. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
hannes08 Posted October 30, 2012 Posted October 30, 2012 You can use WMI/AutoIt: Set objWMIService = GetObject("winmgmts:" & strComputer & "rootCIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkConnection", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems WScript.Echo "AccessMask: " & objItem.AccessMask WScript.Echo "Caption: " & objItem.Caption WScript.Echo "Comment: " & objItem.Comment WScript.Echo "ConnectionState: " & objItem.ConnectionState WScript.Echo "ConnectionType: " & objItem.ConnectionType WScript.Echo "Description: " & objItem.Description WScript.Echo "DisplayType: " & objItem.DisplayType WScript.Echo "InstallDate: " & WMIDateStringToDate(objItem.InstallDate) WScript.Echo "LocalName: " & objItem.LocalName WScript.Echo "Name: " & objItem.Name WScript.Echo "Persistent: " & objItem.Persistent WScript.Echo "ProviderName: " & objItem.ProviderName WScript.Echo "RemoteName: " & objItem.RemoteName WScript.Echo "RemotePath: " & objItem.RemotePath WScript.Echo "ResourceType: " & objItem.ResourceType WScript.Echo "Status: " & objItem.Status WScript.Echo "UserName: " & objItem.UserName WScript.Echo Next Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
hannes08 Posted October 30, 2012 Posted October 30, 2012 Here you go: expandcollapse popup$wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:" & $strComputer & "") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkConnection", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems ConsoleWrite("AccessMask: " & $objItem.AccessMask & @CRLF) ConsoleWrite("Caption: " & $objItem.Caption & @CRLF) ConsoleWrite("Comment: " & $objItem.Comment & @CRLF) ConsoleWrite("ConnectionState: " & $objItem.ConnectionState & @CRLF) ConsoleWrite("ConnectionType: " & $objItem.ConnectionType & @CRLF) ConsoleWrite("Description: " & $objItem.Description & @CRLF) ConsoleWrite("DisplayType: " & $objItem.DisplayType & @CRLF) ConsoleWrite("InstallDate: " & $objItem.InstallDate & @CRLF) ConsoleWrite("LocalName: " & $objItem.LocalName & @CRLF) ConsoleWrite("Name: " & $objItem.Name & @CRLF) ConsoleWrite("Persistent: " & $objItem.Persistent & @CRLF) ConsoleWrite("ProviderName: " & $objItem.ProviderName & @CRLF) ConsoleWrite("RemoteName: " & $objItem.RemoteName & @CRLF) ConsoleWrite("RemotePath: " & $objItem.RemotePath & @CRLF) ConsoleWrite("ResourceType: " & $objItem.ResourceType & @CRLF) ConsoleWrite("Status: " & $objItem.Status & @CRLF) ConsoleWrite("UserName: " & $objItem.UserName & @CRLF) ConsoleWrite( @CRLF) Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_NetworkConnection" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Thanks to AutoIt-Scriptomatic! Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
jdelaney Posted October 30, 2012 Author Posted October 30, 2012 perfect; thanks, much. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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