; MCGroups.KIX
/*Hmmm. Might be able to "use * /DELETE" here. Need to check with E.D. Mgt. Team*/
use G: /DELETE
use J: /DELETE
use K: /DELETE
use L: /DELETE
use N: /DELETE
use O: /DELETE
use P: /DELETE
use Q: /DELETE
use R: /DELETE
use V: /DELETE
use W: /DELETE
use X: /DELETE
use Y: /DELETE
use Z: /DELETE
/* I don't think these are needed now*/
GLOBAL $CL
GLOBAL $Credentials
/* Lets parse the CommandLine and make it more friendly*/
for each $Arg in GetCommandLine(1)
$Ct = $Ct + 1
if $Ct = 4 $Dm = $Arg endif
if $Ct = 5 $UN = $Arg endif
if $Ct = 6 $PW = $Arg endif
next
$Credentials = $DM + "\" + $UN
/* ALL users in the E.D. should have these drives*/
use I: /DELETE
use I: "\\hospfilesrv\ss2\ed\ercommon" /user:$Credentials /password:$PW
use H: /DELETE
use H: "\\hospfilesrv\Home\$UN" /user:$Credentials /password:$PW
/*
; Per C.A.B.
; This section to be implemented for a redirection if it has not been done already
; Still needs testing. If it requires a restart or re-logon to take affect then
; we may need another solution. Will alpha in isolated ESIS Domain.
; Oh, and the test is generic. Will send through ESIS/Server for input.
; Also need to test and see if "HKCU" = "HKEY_CURRENT_USER" in KiXtart
; "File.txt" is merely a token. Be better served to see what the key
; currently says and change only if needed.
IF NOT EXIST ("H:\")
$Text = "No Home Folder found." + @CRLF
$Text = $Text + "Call us at 323-8586 and get one on server:" + @CRLF
$Text = $Text + "\\hospfilesrv\home"
MESSAGEBOX ($Text, "Home Folder Missing", 4160, 300)
ELSE
IF NOT EXIST ("H:\File.txt")
COPY "File.txt" "H:\" /h /r
$Val1 = [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
$Val2 = [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
WRITEVALUE ("$Val1", "Personal", "H:\\", "REG_EXPAND_SZ")
WRITEVALUE ("$Val1", "My Pictures", "H:\\My Pictures", "REG_EXPAND_SZ")
WRITEVALUE ("$Val1", "My Music", "H:\\My Music", "REG_EXPAND_SZ")
WRITEVALUE ("$Val1", "My Videos", "H:\\My Videos", "REG_EXPAND_SZ")
WRITEVALUE ("$Val2", "Personal", "H:\\", "REG_EXPAND_SZ")
WRITEVALUE ("$Val2", "My Pictures", "H:\\My Pictures", "REG_EXPAND_SZ")
WRITEVALUE ("$Val2", "My Music", "H:\\My Music", "REG_EXPAND_SZ")
WRITEVALUE ("$Val2", "My Videos", "H:\\My Videos", "REG_EXPAND_SZ")
ENDIF
ENDIF
*/
;Author: Allen Powell
; He combined a couple of things into a more elegant piece of code.
for each $groupname in GetADUserGroups($Credentials)
if $groupname="edmgt"
use H: /DELETE
use H: "\\hospfilesrv\edmgt" /user:$Credentials /password:$PW
endif
if $groupname="Local Machine Admin"
use Y: /DELETE
use Y: "\\mctech02repo\backup" /user:$Credentials /password:$PW
use Z: /DELETE
use Z: "\\mctech\software" /user:$Credentials /password:$PW
endif
next
;Function: GetADUserGroups() - Get User Properties / Attributes from Active Directory
;Author: Allen Powell
;Version: 1.0.0 2010/05/13
;Action: Get a Users Groups from Active Directory
;Syntax: GetADUserGroups(optional $user, optional $mode)
;Parameters:
; $user(optional) Supply the user name in the form of USERNAME or DOMAIN\USERNAME.
; If ommitted, will default to the current user.
; $mode(optional) 0 = GroupNames, 1 = Group OU Names. Defaults to GroupNames
;Returns: An array of groupnames, or nothing
;Dependencies: None
;Example:
; for each $group in GetADUsergroups("username")
; ? $group
; next
;
function getADUserGroups(optional $username, optional $mode)
Dim $objTrans, $objUser, $group, $array[0], $i
if $username=""
$username=@ldomain + "\"+ @userid
endif
if not instr($username,"\")
$username=@ldomain + "\" + $username
endif
$objTrans = CreateObject("NameTranslate")
if @error
exit @error
else
$objTrans.Init(3, "")
$objTrans.Set(3,$username)
$username = $objTrans.Get(1)
if @error
exit @error
else
for each $group in getobject("LDAP://" + $username).GetEx("memberof")
redim preserve $array[$i]
if $mode=0
$array[$i]=GetObject("LDAP://" + $Group).cn
else
$array[$i]=$group
endif
$i=$i+1
next
$getADUserGroups=$array
endif
endif
endfunction