Timed automatic copy
1.1 Establish the following script file, for example: NetCopy.vbs
Set Wn = CreateObject ("wscript.network")
SET FSO = CreateObject ("scripting.filesystemObject")
'Mapping the personal backup directory on the backup server
Wn.mapNetworkDrive "N:", "// 192.168.0.5/backup" ,false, "bkuser1", "mypwd"
'Start backup
Fso.copyfolder "d: / mydoc /*.*", "n: / mydir", TRUE
'Cancel mapping
Wn.removenetworkDrive "N:", TRUE
SET WN = Nothing
SET FSO = Nothing
1.2 Establishing a backup task in Windows, this step is not to talk.
2. Can you use ADO? The answer is yes.
StrConn = "driver = {SQL Server}; server = localhost; uid = sa; pwd = sapwd; database = master"
Set objconn = creteObject ("adodb.connection")
Objconn.connectionstring = STRCONN
Objconn.mode = 3
Objconn.commandtimeout = 0
Objconn.open
Objconn.execute ("Uses Master")
Objconn.execute ("exec doanything")
Objconn.close
Set objconn = Nothing
3. Modify the file permissions of the NTFS hard drive
Set objnet = wscript.createObject ("wscript.network")
SET WS = WScript.createObject ("wscript.shell")
SET FSO = WScript.createObject ("scripting.filesystemobject")
SET D = fso.getdrive ("d")
IF (D.DriveType = 2 and D.FileSystem = "NTFS") THEN
IUSR = "IUSR_" & ObjNet.computername
WS.Run ("AttriB / S / D -R A D: / DIR1")
WS.Run ("CACLS D: / DIR2 / T / E / P" & IUSR & ": R")
WS.Run ("CACLS D: / DIR3 / T / E / P" & IUSR & ": C")
WS.Run ("CACLS D: / DIR4 / T / E / P" & IUSR & ": f")
END IF
Set objnet = Nothing
SET WS = Nothing
SET FSO = Nothing
4. I know that Admi (Active Directory Service Interface)
ADSI is MS to engage in Novell's NDS, very powerful. Below is a small application to establish an IIS site:
Set objnet = wscript.createObject ("wscript.network") set objWebsvc = getObject ("IIS: //" & objnet.computername & "/ w3svc, iiswebservice")
'Calculate the next correct site number
INDEX = 0
BBLANK = FALSE
For Each S in ObjwebsVC
If S.class = "Iisweb Server" THEN
INDEX = INDEX 1
IF (cint (s.name)> index) THEN
BBLANK = TRUE
EXIT for
END IF
END IF
NEXT
IF (not bblank) THEN INDEX = INDEX 1
'Establishing a site object
Set W = Objwebsvc.create ("IisWebserver", Index)
'Setting properties, the following are basically necessary. Please refer to MSDN
w.keytype = "iiswebserver"
W.Servercomment = "New WWW Site"
W.Serverbindings = Array (": 81: input.your.hostname")
w.enableDefaultdoc = TRUE
w.defaultdoc = "default.asp"
'Every site must have a virtual root directory root
Set r = w.create ("IisWebVirtualDir", "root")
R.Path = "d: / inetpub"
R.AppFriendlyName = "Default Application"
R.Appcreate2 2
R.accessRead = true
R.accessscript = true
R.enableDirBrowsing = false
R.setInfo
W.setInfo
SET W = Nothing
SET R = Nothing
Set objWebsvc = Nothing
Set objnet = Nothing