Sign in to follow this  
Followers 0
JonF

Send to Windows Explorer address bar for webDAV

8 posts in this topic

I'm trying to get my users access to our main information store without having to connect to the VPN (which uses port 10443 and is blocked in some places). I have WebDAV set up on the server and connecting works if I type or paste:

remote.{domain}.com@SSL@443DavWWWRootDriveZ

into the Explorer address bar. It prompts for login information even if running from a domain-joined computer logged in with appropriate credentials. However, if I try to create a shortcut (in any of several ways) Explorer does not make the connection, does not display login information, and displays some local directory (usually My Documents).  It appears that the only way to make this connection is to enter the path in Explorer's address bar.  I tried the following:

$Path = "\\remote.{domain}.com@SSL@443\DavWWWRoot\DriveZ"
 
Func _GetHwndFromPID($PID)
    $hWnd = 0
    $stPID = DllStructCreate("int")
    Do
        $winlist2 = WinList()
        For $i = 1 To $winlist2[0][0]
            If $winlist2[$i][0] <> "" Then
                DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID))
                If DllStructGetData($stPID, 1) = $PID Then
                    $hWnd = $winlist2[$i][1]
                    ExitLoop
                EndIf
            EndIf
        Next
        Sleep(100)
    Until $hWnd <> 0
    Return $hWnd
EndFunc ;==>_GetHwndFromPID
 
$ExplorerPID = Run("explorer.exe")
$Handle = _GetHwndFromPID($ExplorerPID)
ControlSend($Handle,"",41477,$Path)
 
but it acts just like the shortcuts.
 
Any ideas?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

First thing I'd try is _IENavigate.

To iterate on that, the object to the shell window, then use the obj.navigate method.

Edit:

Question... Would:

$gnPID = ShellExecute("\\remote.{domain}.com@SSL@443\DavWWWRoot\DriveZ")

Not work?

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

To iterate on that, the object to the shell window, then use the obj.navigate method.

Edit:

Question... Would:

$gnPID = ShellExecute("\\remote.{domain}.com@SSL@443\DavWWWRoot\DriveZ")

Not work?

 

Nope, it wouldn't work.  post-38071-0-21198800-1417793279_thumb.p

It never asked for credentials.  The only way I've gotten it to ask for credentials is to enter the path directly into the address bar.

I'm not excited about using IE.  Most of my users are PhDs in biological science of one sort or another, but several of them have issues with unfamiliar concepts such as file browsing in IE.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You could try mapping a network drive:

net use Z: "remote.{domain}.com@SSL$443DavWWWRootDriveZ" /user xxxx Pa$$word

Then you could delete the mapped drive:

net use z: /delete

or maybe add

#RequireAdmin at the top of your script

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Sorry, I think you missed the point with me about the .navigate, I didn't know JohonOne assumed it was IE.

This is (working/pseudo) code of what I was talking about:

Global $gsPath = "C:\Windows\System32"
; the way this is setup, you're likely to be trapped in the loop (add error checking) than to be errored out
Global $goExplorer = _createNewExplorerWindow()
$goExplorer.Navigate($gsPath)

Func _createNewExplorerWindow()

    Local $oShell = ObjCreate("Shell.Application")
    Local $oWin1 = $oShell.windows(), $oWin2
    Local $nCount = $oWin1.count()

    $oShell.Explore("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
    Do
        Sleep(50)
        $oWin2 = $oShell.windows()
    Until $nCount <> $oWin2.count()

    Return $oWin2($oWin2.count() - 1)
EndFunc
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

@JohnOne:  Yeah, I meant Windows explorer.  I intended to be more precise but wasn't.  Sorry.

@SmOke_N: Works fine for local paths, gives a new error message for my case: post-38071-0-68334100-1418138127_thumb.p.

@computergroove:  Aha!  That works (after adding the colon after /user and changing the / before DavWWWRoot to @).  Fascinating.  I used to have a script that mapped a free drive to WebDAV with net use, and it stopped working after some server update.  That's why I was going through this whole exercise.  But I dug up the @SSL$443@DavWWWRoot syntax well after I gave up on that idea and never thought of going back to it with the new syntax.

Problem solved!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • spuuunit
      By spuuunit
      This is what I'm trying to do: In Firefox, if you hold down CTRL + C for about 200ms, then press CTRL + T. This is my code:
      While WinActive(" - Mozilla Firefox") If _IsPressed("A2", $hDLL) And _IsPressed("43", $hDLL) Then $timer = TimerInit() While _IsPressed("A2", $hDLL) And _IsPressed("43", $hDLL) Sleep(10) $diff = TimerDiff($timer) If $diff > 200 Then Send("^{T}") While _IsPressed("A2", $hDLL) And _IsPressed("43", $hDLL) Sleep(10) WEnd EndIf WEnd EndIf WEnd The problem is that the CTRL key gets stuck down after Send("^{T}"). I found this, but what I understand that happens when I release, and that is not what I want. The "General unstuck method" did nothing.
    • Baboo85
      By Baboo85
      Hi all,
      I need to start a script that include:
      - admin privileges
      - multiple cmd commands
      - no bat, no exe, no tmp files created anywhere (especially in the user temp folder)
      In a bat file it would be simple, but users shouldn't see what commands I'm sending.
      Example of the script:
      echo off cls echo. echo I AM A TOOL echo. echo NOTE: echo - note 1 echo - note 2 echo - etc set USER1=0 set COMPUTER1=0 if /i %username% equ user.user ( set USER1=1 set COMPUTER1=1 ) if /i %username% equ another.user set USER1=1 if /i %computername% equ notebook set COMPUTER1=1 if %USER1% EQU 1 ( if %COMPUTER1% EQU 1 ( reg delete "HKLM\SOFTWARE\blablabla" /f ) else ( echo Computer not authorized. Contact assistance.) ) else ( echo User not authorized. Contact assistance.) echo. pause exit With the send("") is a disaster.
      I'm a noob here, so what can I do?
       
      EDIT: OR ELSE I explain the situation and what I need, so if there is a simple solution I can use that.
       
      SITUATION: our domain users have Users rights on the machine. Some of them need administrator rights.
      We create a local user with administrator rights, so that the users must insert username and password when asked to run something with administrator rights.
      We have an internal domain group policy that blocks EXE, BAT, COM, TMP files from the user local temp directory, for a security reason (malware). That also blocks most software installation.
      But some users are often out of office, away from workplace and in another country, they need a complete control on their computers.
       
      WHAT I NEED: I need to check the username and the computer name. If the username is the one with local administrator rights and the computer name is a computer that is qualified to temporary remove the policy, then I need to execute a REG DELETE command with administrator rights.
       
      I hope I explained myself.
       
      Thank you very much.
    • Jefrey
      By Jefrey
      I've made this HTTP lib to simplify HTTP requests, mainly when dealing about POST data or file uploads.
      Three functions are available:
      string _HTTP_Get ( string $sURL ) string _HTTP_Post ( string $sURL , string $sPostData ) string _HTTP_Upload ( string $sURL , string $sFilePath , string $sFileField , string $sPostData = '' , string $sFilename = Default) Additionaly, two helper functions are also available:
      URLEncode($sStr) URLDecode($sStr) Full documentation: https://github.com/jesobreira/HTTP.au3/blob/master/README.md
      Fork me on Github: https://github.com/jesobreira/HTTP.au3
      Download lib + docs: https://github.com/jesobreira/HTTP.au3/archive/master.zip
    • caramen
      By caramen
      Hello guys.
      I have got this script
      $iPid = run("Powershell Get-ADUser "&$UserNameReaded&" -Properties * | select -Expand EmailAddress" , @WindowsDir , @SW_HIDE , 0x2) $MailUser = "" While 1 $MailUser &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd GUICtrlSetData ($Label015, ""&$MailUser) If $MailUser = "" Then GUICtrlSetData ($Label017 , "N/A"&$MailUser) Everything is working fine i got correct value
      For my account the value is for exemple :
      J.Personnal@Enterprise.com in the $Label017 the value is correct i have still
      J.Personnal@Enterprise.com If i use :
      Send (""&$MailUser) i have now :
      J.Personnalnterprise.com Is there a way to correct this ?
    • darkangel37
      By darkangel37
      hello im trying to automate random greetings word from .txt file  and write/send some strings but it gives me error
      please be gentle to me im kinda newbie thank you
      $File = FileReadToArray("words.txt") $RandomWords = $File[Random(0, UBound($File) - 1, 1)] send ("$RandomWords") sleep (1000) send ("{enter}")