Sorry here is the script
<!-------------------------------------------------------->
' FolderPermssions.vbs
' Various folder functions and subs
' replaces ShowFolderPermissions.vbs
' ShowFolderPermissions
' ShowFolderPermissionsAll
' CopyFolderPermissions
'
' Andy Ball 18/12/2001
' Updated 2/20/03 by Michael Linster. I had found some problems
with script as it was and have updated it to function correctly.
Option Explicit
Const adModeReadWrite = 3
Dim oArgs ' for arguements passed in
Dim WshShell
Dim arrPermissions
Dim SourceFolderPath
Dim DestFolderPath
Dim Counter
dim oCode
' get the args
Set WshShell = Wscript.CreateObject("Wscript.Shell")
set oArgs=Wscript.Arguments
' Call the relevant
' ie this is an error
If oArgs.Count < 1 Then
WScript.Echo "Usage : CSCRIPT ShowFolderPermission.vbs <sourcefolderpath>
<destfolderpath>"
WScript.Echo "Usage : CSCRIPT ShowFolderPermission.vbs
http://server/workspace/documents
http://server/workspace/documents/test"
WScript.Quit
Elseif oArgs.Count > 1 then
DestFolderPath = oArgs.Item(1)
SourceFolderPath = oArgs.Item(0)
oCode = "1"
Else
SourceFolderPath = oArgs.Item(0)
oCode = "2"
End If
' copy perms and show
if oCode = "1" then
CopyFolderPermissions SourceFolderPath, DestFolderPath
else
ShowFolderPermissionsAll SourceFolderPath
end if
'----------------------------------------------------------------
----------------------------------------------------------------
' Sub ShowFolderPermission
' Shows permissions on the relevant folder
Sub ShowFolderPermissions (FolderPath, Permission)
Dim arPermissions ' Array to store current permissions
Dim oFolder ' folder object
Dim user ' item used in FOR EACH in array
Dim ArrayItemCount
' Create object
set oFolder = CreateObject("CDO.KnowledgeFolder")
' Open the folder
oFolder.DataSource.Open FolderPath
' Return the relevant array depending on the type of user
Select Case UCASE(Permission)
Case "READER" arPermissions = oFolder.Readers
Case "COORDINATOR" arPermissions = oFolder.CoOrdinators
Case "AUTHOR" arPermissions = oFolder.Authors
' trap dodgy permission. Would be cool if could retrive valid permissions
as this is likely to change between versions
Case Else WScript.Echo Permission & " is not valid. Should be
READER, AUTHOR or Coordinator"
Exit Sub
End Select
' Get the number of items in the array
ArrayItemCount = UBound(arPermissions) + 1
' ie if no (say) readers print message
if ArrayItemCount = 0 Then
WScript.Echo "No " & Permission & " Permissions on " & FolderPath
' Otherwise roll through printing permissions
Else
Wscript.Echo Permission & "S of " & FolderPath
For Each User in arPermissions
Wscript.Echo vbTAB & User
Next
End If
set oFolder = Nothing
End Sub
' show all permissions
' Procedure ShowFolderPermissionsAll
Sub ShowFolderPermissionsAll(FolderPath)
ShowFolderPermissions FolderPath, "READER"
ShowFolderPermissions FolderPath, "AUTHOR"
ShowFolderPermissions FolderPath, "COORDINATOR"
End Sub
' CopyFolderPermissions - Copy Folder Permissions from one folder
to another.
Sub CopyFolderPermissions (SourceFolderPath, DestFolderPath)
Dim arPermissions ' Array to store current permissions
Dim oSourceFolder ' folder object
Dim oDestFolder
Dim User ' item used in FOR EACH in array
Dim ArrayItemCount
' Create objects - one for source , one for dest
set oSourceFolder = CreateObject("CDO.KnowledgeFolder")
set oDestFolder = CreateObject("CDO.KnowledgeFolder")
' Open the folder, note need to open dest in read write mode.
oSourceFolder.DataSource.Open SourceFolderPath
oDestFolder.DataSource.Open DestFolderPath , , adModeReadWrite
' copy over the 3 permissions
oDestFolder.Readers = oSourceFolder.Readers
oDestFolder.Authors = oSourceFolder.Authors
oDestFolder.CoOrdinators = oSourceFolder.Coordinators
' then save
oDestFolder.DataSource.Save
End Sub
<!-------------------------------------------------------->