Mark Minasi's Reader Forum
Mark Minasi's Reader Forum
Home | Profile | Register | Active Topics | Active Polls | Members | Search | FAQ | Minasi Forum RSS Feed
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old, obsolete or unused
 Scripting Archive
 Rename and create folder
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gustavobapti
Welcome Newcomer

1 Posts
Status: offline

Posted - 11/07/2007 :  5:24:04 PM  Show Profile  Reply with Quote
Hello all.
In my windows 2003 domain all users have their H: drive (a network drive mapped by default during the logon).
Physically the share is located on fileserver's d:/ drive.(D:/Home/).
The share Users consists of folders for each of the users (D:/Home/jsmith, D:/Home/acarter… etc)
I was requested to rename the old folder and create a new folder for each of the users called "Citrix" D:/Home/domainusername/Citrix

I would like to create a vb script to rename the old folder (Citrix to Citrixold) and create a new folder with the same old name " Citrix".

Option Explicit

Function ConfigHome(oUser, sPath, sSite)

set oWSH = CreateObject("WScript.Shell")

If Not FSO.FolderExists(sPath & "\CITRIX") Then

FSO.CreateFolder (sPath & "\CITRIX")


Else



FSO.MoveFolder sPath & "\CITRIX", sPath & "\CITRIX.old"



End If


If Not FSO.FolderExists(sPath & "\CITRIX") Then

FSO.CreateFolder (sPath & "\CITRIX")



Set oCitrixHD = FSO.GetFolder(sPath & "\CITRIX")

If not oCitrixHD.Attributes And 2 Then

oCitrixHD.attributes = oCitrixHD.Attributes XOR 2

End If



'WScript.Sleep 15000

call oWSH.Run("cmd /c echo y| CACLS " & sPath & " /t /e /g " & oUser.SamAccountName & ":f", 0, True)

'WScript.Sleep 5000

call oWSH.Run("cmd /c echo y| SubInACL /file " & sPath & " /setowner=Americas\" & oUser.SamAccountName, 0, TRUE)

'WScript.Sleep 5000

call oWSH.Run("cmd /c echo y| SubInACL /subdirectories " & sPath & "\*.* /setowner=Americas\" & oUser.SamAccountName, 0, TRUE)

End If

End Function


Thanks.


--------------------------------------------------------------------------------
Gustavo

Edited by - gustavobapti on 11/07/2007 5:24:52 PM
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Mark Minasi's Reader Forum © 2002-2011 Mark Minasi Go To Top Of Page
This page was generated in 0.08 seconds. Snitz Forums 2000