|
Тема |
Re: Object required: 'WScript' & za teodor [re: Pechenia] |
|
Автор | psy (Нерегистриран) | |
Публикувано | 12.06.03 16:24 |
|
|
win2k adv server
bez antivir software
a po interesnoto e che v tut ot M$ pak se polzva samo che WScript.Shell i primera si varvi
a WScript.Network ne go razpoznava
inache eto ia funckiata prerabotena ot men za teodor
Function CreateDir(strParam)
Dim strVirtualDirectoryName 'IIS Virtual Directory Name
Dim bolInProcessApplication 'IIS In Process Application Flag
Dim objIIS 'ADSI IIS Object
Dim strVirtualDirectoryPath 'IIS Virtual Directory Path
Dim objFileSystem 'VBScript FileSystemObject
Dim strOwner 'NT Folder Owner
Dim objVirtualDirectory 'ADSI IIS Virtual Directory Object
Dim bolScriptPermissions 'IIS script permissions flag
Dim strHTTPReferer 'IIS Referrer Page
Dim strServerName 'NT local machine name
Dim objWSH 'Windows Script Host Object
Dim objRTC 'Return
Dim strACLCommand 'Command Line string to set ACLs
'obarni vnimanie na tozi red tuk predavash parametara ot funkciata za ime na virt direktoria
strVirtualDirectoryName = strParam
strHTTPReferer = Request.ServerVariables("HTTP_REFERER")
strServerName = Request.ServerVariables("SERVER_NAME")
' Did we come from our form? If not then deny access
'If strHTTPReferer <> "http://" & strServerName & "/ServineSecure/default.asp" then
' Response.Write("Access Denied")
' Response.End
'End If
'strOwner = Request.Form("selectOwner")
'If Request.Form("checkboxScript") = "on" Then
' bolScriptPermissions = "True"
'Else
' bolScriptPermissions = "False"
'End If
' Does this IIS application already exist in the metabase?
On Error Resume Next
Set objIIS = GetObject("IIS://localhost/W3SVC/1/Root/" & strVirtualDirectoryName)
If Err.Number = 0 Then
Response.Write ("An application with this name already exists. Click ")
Response.Write ("<A HREF=http://" &strServerName & "/dir/>")
Response.Write ("here</A> to choose a different name.")
Response.End
End If
Set objIIS = Nothing
'Create the IIS application
Set objIIS = GetObject("IIS://localhost/W3SVC/1/Root")
strVirtualDirectoryPath = objIIS.Path & "\" & strVirtualDirectoryName
Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
'Test to see if the folder exists in the filesystem.
' If not, create it
On Error Resume Next
Set Folder = objFileSystem.GetFolder(strVirtualDirectoryPath)
If Hex(Err.number) = "4C" Then
objFileSystem.CreateFolder strVirtualDirectoryPath
End If
Set objFileSystem = Nothing
'Create the folder in the filesystem
Set objVirtualDirectory = objIIS.Create("IISWebVirtualDir",strVirtualDirectoryName)
objVirtualDirectory.AccessScript = bolScriptPermissions
objVirtualDirectory.Path = strVirtualDirectoryPath
objVirtualDirectory.SetInfo
objVirtualDirectory.AppCreate bolInProcessApplication
'Set Change Permissions for the developer using CACLS.exe
strACLCommand = "cmd /c echo y| CACLS "
strACLCommand = strACLCommand & strVirtualDirectoryPath
strACLCommand = strACLCommand & " /g " &strOwner & ":C"
Set objWSH = Server.CreateObject("WScript.Shell")
objRTC = objWSH.Run (strACLCommand , 0, True)
Set objWSH = Nothing
Response.Write("<B>Web Application Created Sucessfully</B><BR>")
Response.Write("Path : "& strVirtualDirectoryPath & "<BR>")
'Response.Write("Script Permissions : "& bolScriptPermissions &"<BR>")
'Response.Write( strOwner & " has been granted change permissions<BR>")
End Function
|
| |
|
|
|