rbardo
Fresh Scripter
Registered: 2003-07-24
Posts: 47
Loc: USA
|
Ok, thanks for the fyi sealeopard. I will look into that further.
Could you all please help me with my current script? Please look where I put a message in for help area.
code:
;=============================================================================================== ;**** Created with KiXscripts Editor | http://KiXscripts.com **** ;**** Last Modified on 7/25/2003 at 2:17:56 PM by rbardo **** ;===============================================================================================
If @INWIN=1 ; Excludes all Windows 9x systems If LocalAdmin ; Only runs if the user has Local workstation admin rights ; Most installers and uninstallers will not run if the user ; does not have Admin rights $CheckWS=ReadValue('HKLM\Software\MyCompany\WS', 'RANUNINSTALLER') If $CheckWS <> 1 If Exist('%ProgramFiles%\OfficeView Pro\uninstWS.exe') Shell '%COMSPEC% /C %ProgramFiles%\OfficeView Pro\uninstWS.exe /S' $MarkWS=WriteValue('HKLM\Software\MyCompany\WS', 'RANUNINSTALLER', '1', 'REG_SZ') ; Mark the registry so that this program does not run every time the user logs in EndIf EndIf ; I assume you are running this PC Asset Navigator program ; http://www.a-navigator.com/an/index.html Use W: /DELETE /PERSISTENT Use W: '\\holdem\asset_db$' Shell '%COMSPEC% /C W:\ina32.exe' Use W: /DELETE /PERSISTENT EndIf EndIf
; I need help from here ; I am trying to get the sid to use in the next function ; I am not sure how to pass the information gathered here to the next function ;ie: the users name
Break on $SID = GetSID("WinNT://ff/lligetfa,USER") ? $SID
Get $_ Exit 1 ; ;Source Function GetSID($adspath) Dim $rev,$sidobj,$sid,$sac,$x $GetSID=0
$sidobj=CreateObject("adssid") $sidobj.setas(5,$adspath) $sid=$sidobj.getas(1)
If NOT $sid $sidobj=0 Return EndIf
$Rev=Val(SubStr($sid,1,2))
; Extract the SubAuthority Count (SAC) from the SID (range of 1 - 8, hence no hex conversion necessary) $SAC=Val(SubStr($sid,3,2)) $IdentAuth=Val("&"+SubStr($sid,5,12)) $GetSID="S-"+$Rev+"-"+$IdentAuth
; Convert SID little-endian, just re-reverse the bytes and convert to decimal... ; Recurse as per SAC For $X=1 to $SAC $GetSID=$GetSID+"-"+Val("&"+SubStr($sid,8*$X+15,2)+SubStr($sid,8*$X+13,2)+SubStr($sid,8*$X+11,2)+SubStr($sid,8*$X+9,2)) Next
$sidobj=0
EndFunction
Function updateregistry($HKEY_CURRENT_USER, $Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, $Personal=z:\\) Dim $currentregvalue, $currentregtype, $rc $updateregistry=0 If $regtype='' $regtype='REG_SZ' EndIf $currentregtype=ReadType($regsubkey,$regentry) $currentregvalue=ReadValue($regsubkey, $regentry) If $currentregvalue<>$regvalue OR $currentregtype<>$regtype $rc=WriteValue($regsubkey,$regentry,$regvalue,$regtype) If @ERROR Exit @ERROR EndIf $updateregistry=1 EndIf Exit @ERRORendfunction Function updateregistry($HKEY_CURRENT_USER, $Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders, $My Pictures=z:\\My Pictures) Dim $currentregvalue, $currentregtype, $rc $updateregistry=0 If $regtype='' $regtype='REG_SZ' EndIf $currentregtype=ReadType($regsubkey,$regentry) $currentregvalue=ReadValue($regsubkey, $regentry) If $currentregvalue<>$regvalue OR $currentregtype<>$regtype $rc=WriteValue($regsubkey,$regentry,$regvalue,$regtype) If @ERROR Exit @ERROR EndIf $updateregistry=1 EndIf Exit @ERRORendfunction ; to here... ; I know the code is there twice but i dont know how to nest and i needed to change two values as you can see ; The rest of the script will run for all systems including Windows 9x
Use J: /DELETE /PERSISTENT Use J: '\\terminal\slip_stream' $MyDox = '%COMSPEC% /C REGEDIT /S j:\registry\mydox.reg >nul 2>nul' ;$HideC = '%COMSPEC% /C REGEDIT /S j:\registry\hide_c.reg >nul 2>nul' $Outlook = '%COMSPEC% /C REGEDIT /S j:\registry\outlook.reg >nul 2>nul' ; Not sure what this does, but KiX can do all the registry edits natively Use J: /DELETE /PERSISTENT
Use g: '\\ntbaksrv\common' Use i: '\\ntbaksrv\prod' Use k: '\\ntbaksrv\service' Use m: '\\ntserver\sdpcmrpw' Use o: '\\royal\mis' Use y: '\\terminal\share_point'
; use Z: /home ; Don't use this. Map it via the User Manager or AD tools ; Windows 9x Can Not map the Z: drive as the redirector uses this ; drive during the logon process
;printers.kix: ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dim $priReg, $x, $i, $rc, $ps $loc='HKEY_CURRENT_USER\Network\LPT1' $reg='HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion' $dev=$reg+'\Devices' $nprt=Split(ReadValue($reg+'\Windows','Device'),',')[0] $sysdrv=SubStr('%WINDIR%',1,2)
If Exist('H:') $ps='H:\Scripts_DO_NOT_DELETE' Else $ps=$sysdrv+'\Scripts' EndIf If 0=Exist($ps) MD $ps EndIf $ps=$ps+'\Printsetup.ini'
$i=0 Do If '\\'=Left($x,2) $priReg=$priReg+$x EndIf $x=EnumValue($dev,$i) $i=$i+1 Until @error
If Len($priReg) $rc=WriteProfileString($ps,'Printers','','') $priReg=Split($priReg,'\\') For $i=1 to Ubound($priReg) $rc=WriteProfileString($ps,'Printers',$i,'\\'+$priReg[$i]) Next EndIf
Select Case InStr($nprt,'\\') ;WRITE THE DEFAULT PRINTER TO THE CONFIG $rc=WriteProfileString($ps,'Printers','Default',$nprt) Use LPT1: /delete /persistent Use LPT1: $nprt /persistent Case $nprt='' AND Exist($ps) ;NO DEFAULT PRINTER, LOAD PRINTERS FROM SAVED INFO For Each $key In Split(ReadProfileString($ps,'Printers',''),Chr(10)) $nul=AddPrinterConnection(ReadProfileString($ps,'Printers',$key)) Next $nprt=ReadProfileString($ps,'Printers','Default') $rc=SetDefaultPrinter($nprt) Use LPT1: $nprt /persistent Case NOT InStr($nprt,'\\') ;LOCAL PRINTER DEFAULT, SO WE WANT TO REMOVE NETWORK MAPPING Use LPT1: /delete /persistent EndSelect
Function LocalAdmin() $LocalAdmin=InGroup('@wksta\'+SIDToName('S-1-5-32-544'))-1+@inwin EndFunction
Function IdentifyRemoteUser($strComputer) Break On Dim $strComputer $objWMIService = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $strComputer + "\root\cimv2") $colComputer = $objWMIService.ExecQuery ("Select * from Win32_ComputerSystem") For Each $objComputer In $colComputer ? $objComputer.UserName Next EndFunction
Shell '%COMSPEC% /C \\Ntbaksrv\NETLOGON\use.exe'
_________________________
Ekadanta Mahakaya Surya koti samaprabha
Nirbighnam kurume deva sarbakaryeshu sarbada
|