Jump to content

Users Profile Folders


Recommended Posts

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

well guys , it works thanks to a little help from my boss .. we got it working late last night ..

thanks to everyone who helped !!!!!

May I see the final script?

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to comment
Share on other sites

AutoItSetOption("MustDeclareVars", 1)
 
 
#include <File.au3>
#include <Array.au3>
#include <String.au3>
 
;;;;;;;;;;;;;;;;;
;Define Variables
;;;;;;;;;;;;;;;;;

Global $usrArray
Global $i = 1
Global $file = "Usernames.txt"
Global $domain = "domain"
Global $server = "\\server"
Global $profileFolder = "RProfile"
Global $userAccount = "Users"
Global $xcacls = "c:\xcacls.vbs"
Global $pid
Global $j, $TotalProcess, $EachProcess ;Progress meter variables
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Making of the folders from a txt file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

_FileReadToArray($file, $usrArray)
 
;;;;;;;;;;;;;;;
;Progress Meter
;;;;;;;;;;;;;;;

ProgressOn("Progress Meter", "Percentage Complete", "0 percent")
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Define number of process based on number of users
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$TotalProcess = $usrArray[0]*4
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Percentage of each process
;;;;;;;;;;;;;;;;;;;;;;;;;;;

$EachProcess = Round((1/$TotalProcess)*100,0)
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;
;First process percentage
;;;;;;;;;;;;;;;;;;;;;;;;;

$j=$EachProcess
For $i = 1 To $usrArray[0]

;;;;;;;;;;;;;;;;;;;
;Create User Folder
;;;;;;;;;;;;;;;;;;;

DirCreate($server & "\" & $profileFolder & "\" & $usrArray[$i])

ProgressSet( $j, $j & " percent")
$j=$j+$EachProcess

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Remove Inheritance but copy rights
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$pid=RunWait(@ComSpec & ' /c ' & $xcacls & ' "' & $server & '\' & $profileFolder & '\' & $usrArray[$i] & '" /I Copy', @WindowsDir, @SW_HIDE)
ProgressSet( $j, $j & " percent")
$j=$j+$EachProcess

;;;;;;;;;;;;;;;;;;;;;;;;;;
;Remove local User account
;;;;;;;;;;;;;;;;;;;;;;;;;;

$pid=RunWait(@ComSpec & ' /c ' & $xcacls & ' "' & $server & '\' & $profileFolder & '\' & $usrArray[$i] & '" /E /T /R ' & $server & '\' & $userAccount, @WindowsDir, @SW_HIDE)
ProgressSet( $j, $j & " percent")
$j=$j+$EachProcess

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Add/Set permissions for domain user
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$pid=RunWait(@ComSpec & ' /c ' & $xcacls & ' "' & $server & '\' & $profileFolder & '\' & $usrArray[$i] & '" /E /T /G ' & $domain & '\' & $usrArray[$i] & ':F', @WindowsDir, @SW_HIDE)
ProgressSet( $j, $j & " percent")
$j=$j+$EachProcess

Next

ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...