Jump to content

Vbs To Work Out Os Then Map Webdav


buffy
 Share

Recommended Posts

<html>
<head>
<title>HTA Test</title>
<HTA:APPLICATION 
     ID="objTest" 
     APPLICATIONNAME="HTA Test"
     SCROLL="no"
     SINGLEINSTANCE="yes"
>
</head>

<script LANGUAGE="VBScript">


  sub OsCheck
	Dim WshShell : Set WshShell = CreateObject("WScript.Shell") 
    Dim strVer : set strVer = WshShell.exec("%comspec% /c ver") 
  Document.Write(strVer)
		if strVer = "Windows XP" then
        CreateObject("WScript.Shell").Run "net use * http://yourserver.com/work/" & UserArea.Value & " /user:domain\" & UserArea.Value & " " & PasswordArea.Value & ">c:\map.txt"  ,0, True
    	CreateObject("WScript.Shell").Run "cmd /c net use | find " & chr(34) & UserArea.Value & chr(34) & " >c:\map.txt"	,0, True
		CreateObject("WScript.Shell").Run "cmd /c FOR /F " & chr(34) & "usebackq delims=: tokens=1" & chr(34) & " %i IN (c:\map.txt) DO start %i:" ,1,True
        else
		CreateObject("WScript.Shell").Run "net use * http://yourserver.com/work@SSL/" & UserArea.Value & " /user:domain\" & UserArea.Value & " " & PasswordArea.Value  ,0, True
    	CreateObject("WScript.Shell").Run "cmd /c net use | find " & chr(34) & UserArea.Value & chr(34) & " >c:\map.txt"	,0, True
		CreateObject("WScript.Shell").Run "cmd /c FOR /F " & chr(34) & "usebackq delims=: tokens=1" & chr(34) & " %i IN (c:\map.txt) DO start %i:" ,1,True
        end if
 end sub



	</SCRIPT>

<body>
    Welcome to the AMG remote connection application.<P>
    Please enter your username here:<P>
    <input type="text" name="UserArea" size="50"><P>
    <P>
    Please enter your password here:<P>
    <input type="password" name="PasswordArea" size="30"><P>
    <input id=runbutton  class="button" type="button" value="Connect" name="run_button"  onClick="OsCheck">
</body>


The real problem is I dont know carp about VBS so me+google+monster+wine has left the above mess. The idea is to check OS ver, if XP not to use SSL as it cant support it out of the box.

any help would be welcomed.

Thanks

Buffy.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...