Man of Honour
- Joined
- 17 Oct 2002
- Posts
- 9,712
- Location
- Retired Don
Hi guys,
We use the following script to create a new folder within a user's home directory, and then share is foldername$
Would anyone be able to edit it so it skips a step, eg shares the actual user folder as foldername$
Say there is a folder, called D:\Users, within that folder are folders Folder1, Folder2, Folder3 etc etc
We'd want to share thoose folders as Folder1$, folder2$, folder3$ etc
Cheers guys!
Mal
Would quite appreciate if someone could explain the terms to me as I like to learn!!
Cheers
We use the following script to create a new folder within a user's home directory, and then share is foldername$
Would anyone be able to edit it so it skips a step, eg shares the actual user folder as foldername$
Say there is a folder, called D:\Users, within that folder are folders Folder1, Folder2, Folder3 etc etc
We'd want to share thoose folders as Folder1$, folder2$, folder3$ etc
Cheers guys!
Mal
'Change the following line to true or false depending on whether a log file is required
bolCreateLog = true
strInput = inputbox( "Enter the name of the folder where your users' folders are stored eg. D:\Users" )
strServer = inputbox( "Enter the name of the server which holds the users home folders eg. SERVER" )
if bolCreateLog then
strLogFileName = InputBox( "Enter the full path and filename of the logfile to create eg D:\log.txt" )
Dim objFSO, objFile
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
if not objFSO.FileExists( strLogFileName ) then
Set objFile = objFSO.CreateTextFile( strLogFileName, true )
else
msgbox "Log file already exists. Please run this script again and choose another name for the logfile."
end if
Set objFSO = nothing
end if
on error resume next
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objShell = CreateObject( "WScript.Shell" )
Set folder = objFSO.GetFolder( strInput )
err.clear
for each subfolder in folder.subfolders
for each subf in subfolder.subfolders
if subf.name = "home" then
Set objADSI = GetObject( "WinNT://" & strServer & "/lanmanserver" )
set objHomeShare = objADSI.Create( "FileShare", subfolder.name & "$")
Set objADSI = nothing
objHomeShare.Put "Path", subf.path
objHomeShare.Put "Description", "home share for " & subfolder.name
objHomeShare.SetInfo
Set objHomeShare = nothing
if bolCreateLog then
if Err.number then
objFile.WriteLine subfolder.Name & " home folder sharing failed with error " & err.number
else
objFile.WriteLine subfolder.Name & " home folder shared successfully"
end if
end if
Err.clear
end if
next
next
Would quite appreciate if someone could explain the terms to me as I like to learn!!
Cheers