You are on page 1of 4

Student Name Alexander Santiago

Class

COMP230

Date 15 Sep 16

VBScript Network Shares Lab Report


In the space provided below, copy and paste your NetShareServer.vbs Program Code.
' VBScript: NetShareServer.vbs
' Written by: Alexander Santiago
' 15 Sept 2015
' Class: COMP230
' Professor: Professor Stanley Kuchel
'=======================================================
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileServ = GetObject("WinNT://vlab-PC1/lanmanServer,FileService")
If fso.folderexists("C:\public") then
fso.deletefolder("C:\public")
Wscript.echo"Public folder deleted"
End if
fso.CreateFolder("C:\Public")
fso.CopyFile "C:\Windows\Cursors\w*.*","C:\Public"
WScript.Echo vbCrLf & "Current Network Shares"
For Each sh In fileserv
WScript.Echo sh.name
Next
Set share = fileServ.Create("FileShare","PublicData")
share.Path = "C:\Public"
share.MaxUserCount = 10
share.SetInfo
WScript.Echo vbCrLf
WScript.Echo "New Network Shares"
For Each sh In fileServ
WScript.Echo sh.name
Next
WScript.Echo vbCrLf & "\\vlab-PC1\PublicData Share will be Available for 60 Seconds!!"
WScript.Sleep(60000
fileServ.Delete "FileShare","PublicData"
fso.DeleteFolder "C:\Public",True
WScript.Echo vbCrlf & "End of Program"

COMP230_Wk3_Network_Shares_Report.docx

Revision Date: 1213

In the space provided below, copy and paste the RUN of your NetShareServer.vbs program.
c:\comp230>cscript NetShareServer.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Public folder deleted
Current Network Shares
PC1-Scripts
print$
PublicData
Users
c:\comp230\NetShareServer.vbs(25, 1) Active Directory: The directory object exists.

COMP230_Wk3_Network_Shares_Report.docx

Revision Date: 1213

In the space provided below, copy and paste your NetShareClient.vbs Program Code.
' VBScript: NetShareClient.vbs
' Written by: Alexander Santiago
' 16 Sept 2015
' Class: COMP230
' Professor: Professor Stanley Kuchel
'=======================================================
Set fso = CreateObject("Scripting.FileSystemObject")
Set networkObj = WScript.CreateObject("WScript.Network")
networkObj.MapNetworkDrive "X:","\\vlab-PC1\PublicData"
Set folder = fso.GetFolder("X:\")
Set files = folder.Files
WScript.Echo vbCrLf
WScript.Echo "Contents of Mapped Drive X:"
For Each item In files
WScript.Echo item.Name
Next
networkObj.RemoveNetworkDrive "X:",True
WScript.Echo vbCrLf & "End of Program"

COMP230_Wk3_Network_Shares_Report.docx

Revision Date: 1213

In the space provided below, copy and paste the RUN of your NetShareClient.vbs program.
c:\comp230>cscript NetShareClient.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Contents of Mapped Drive X:


wait_i.cur
wait_il.cur
wait_im.cur
wait_l.cur
wait_m.cur
wait_r.cur
wait_rl.cur
wait_rm.cur
End of Program

COMP230_Wk3_Network_Shares_Report.docx

Revision Date: 1213

You might also like