Mark Minasi's Reader Forum
Mark Minasi's Reader Forum
Home | Profile | Register | Active Topics | Active Polls | Members | Search | FAQ | Minasi Forum RSS Feed
 All Forums
 Old, obsolete or unused
 Scripting Archive
 Rename and create folder

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Note: please do not cross-post.
Cross-postings will be deleted and ignored.
Thanks for helping to keep this forum junk-free!
   

T O P I C    R E V I E W
gustavobapti Posted - 11/07/2007 : 5:24:04 PM
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

Mark Minasi's Reader Forum © 2002-2011 Mark Minasi Go To Top Of Page
This page was generated in 0.11 seconds. Snitz Forums 2000