Go4Expert (http://www.go4expert.com/)
-   JavaScript and AJAX (http://www.go4expert.com/forums/javascript/)
-   -   VBS Script Help Needed Please (http://www.go4expert.com/forums/vbs-script-help-t10040/)

iced_russian 15Apr2008 10:26

VBS Script Help Needed Please
Hi sorry if im in the wrong section but I came across this forum and I saw vbs on the title and I thought It was appropriate. :embarasse

Im hoping some one can help me with the problem that im having regarding a script that I put together from a couple of others.

Long story short Im having an issue with user roaming profiles that have been configured for Citrix. Some of the server only see a folder if the user has full control over the folder + folder name = username and others only see the folder if the user has full control + folder name= username.domain. The issue was introduced because some of the citrix TS servers are 2003 and others are 2003 Sp2.

Patching is not a solution that is currently on the table. After having a look around I found several methods but non of witch worked hence I came with this script

The scrip supposed to check
a. Does the folder exist
b. If not create it
c. Assign full control from a user to the folder.

The scipt works fine it creates folder/checks them. It assigns proper permissions to the folder. But the issue is that when the script is runs on login it comes up with an error Line X Char X errors. Now after going through the script I have tried to fix as many of these as i can but the errors still pop up. Unfortunately my knowledge of VBS is very limited and Im not able to figure out why the script continuously errors. :worried:


Option Explicit
Dim objFSO, objFolder, objShell, intRunError
Dim strDirectory, strHome, strUser

strDirectory = "\\milfs02\profilests$\%username%"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")

If objFSO.FolderExists(strDirectory) Then
Set objFolder = objFSO.GetFolder(strDirectory)

Set objFolder = objFSO.CreateFolder(strDirectory)
WScript.Echo "Just created " & strDirectory
End If

set objFolder = nothing
If objFSO.FolderExists(strDirectory) Then
                intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
                & strDirectory & " /e /c /g %username%:F ", 2, True)

                If intRunError <> 0 Then
                        Wscript.Echo "Error assigning permissions for user " _
                        & strUser & " to home folder " & strDirectory
                End If
        End If
End Function

It was combinde from http://www.computerperformance.co.uk/ezine/ezine78.htm and http://www.go4expert.com/showthread.php?t=1890

Thankyou in advance and I hope someone can help.

All times are GMT +5.5. The time now is 00:38.