Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logon scripts using batch file,vbs and kix32.

Status
Not open for further replies.

MrAlmo

MIS
Feb 26, 2003
3
US
I am in a windows 2000 server environment with 50% of the PC's Win98 and the other 50% NT/XP.I am trying to add a vbs script that was written to audit PC's if users are in the "audit" group. I am very new at this but it appears that my batch file is designed to determine OS and determine if Virus Protection is installed (if not, install) and also map drives. If the OS in 98 I believe Kix32 runs a script. Without messing anything up I would like to get the VBS script to run for all the users in the audit group. Should I just put in "run audit.vbs" script in my logon bat file? Any ideas would be greatly appreciated. I will paste each script here for reference. It appears to me that having all these different formats is more confusing than it needs to be. I am not sure where to start. Thank-you.

Login Script. Batchfile
@Echo Off
@Echo aspen Windows 2000 Logon Process Version 1.2 Initiating
Rem ----------------------------------------------------------
Rem For all users that not in the HR or Finance Group
Rem This script will not connect to K:\Specific share
Rem __________________________________________________________

if "%OS%" == "windows_98" goto win_98
:win_98
:pause
@SET LANG=ENU
@SET FILE_SERVER=aspen_HR
@ECHO OFF
REM *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
REM
REM VPLOGIN.BAT
REM Description: Client login script file for Windows NT Servers running
REM Norton AntiVirus Corporate Edition
REM
REM *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

REM %0\..\NBPSHPOP +T: \\%FILE_SERVER%\vplogon

if "%OS%" == "Windows_NT" goto WINNT_NBPSHPOP

%0\..\NBPSHPOP +T: \\%FILE_SERVER%\vplogon

goto MOVEON

:WINNT_NBPSHPOP

NBPSHPOP +T: \\%FILE_SERVER%\vplogon

:MOVEON

T:\OSVER
IF ERRORLEVEL 2 GOTO WIN_32
GOTO 16BIT

REM *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

:WIN_32
T:\VP_Log32 /p=T:
GOTO END

REM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

:16BIT
T:\VP_Log16 /l=%LANG% /p=T:\ /n=4

REM =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

:END

rem %0\..\NBPSHPOP -T:

if "%OS%" == "Windows_NT" goto WINNT_NBPSHPOP_END

%0\..\NBPSHPOP -T:

goto MOVEON_END

:WINNT_NBPSHPOP_END

NBPSHPOP -T:

:MOVEON_END

:pause

IF %DEBUG%. == . GOTO Normal
ECHO Running %0 in debug mode

:Normal
@Echo Determine operating environment
:: Determine operating environment
if "%processor_architecutre%"=="x86" Set OS=Windows_NT
if NOT "%winbootdir%."=="." Set OS=WIN_95
if .%comspec% == . set comspec=c:\command.com

:: Script Name
Set Script=%0\..\aspen

:: Script Directory
Set SCRDIR=C:\aspen

Goto %OS%

:Windows_NT
@Echo Update NT Script Files, Please Wait...
Echo Mapping Network Drives - J: N: P:
Net use J: /d > nul
Net Use J: \\HQMAIN1\Apps
Net use N: /d > nul
Net use N: \\HQMAIN1\aspenData
Net use P: /d > nul
Net use P: \\HQMAIN1\Public


Goto ENDCOMMON


:WIN_95
@Echo Update Windows 95/98 Script Files, Please Wait...
If not exist %SCRDIR% MD %SCRDIR% > nul
if not exist %SCRDIR%\kix32.exe xcopy \\HQMaindc1\netlogon\aspen\*.* %SCRDIR% /E /I /Y > nul
if not exist %windir%\system\kx16.dll xcopy %SCRDIR%\*.dll %windir%\system /E / I /Y >nul
echo %username%
echo %SCRDIR%\Kix32.exe %SCRDIR%\aspen.SCR
%SCRDIR%\Kix32.exe %SCRDIR%\aspen.SCR

Echo Mapping Network Drives - J: N: P: K:
net use J: /d >nul
Net Use J: \\HQMAIN1\Apps
net use N: >nul
Net use N: \\HQMAIN1\aspenData
Net use P: /d
Net use P: \\HQMAIN1\Public

Echo Mapping Home Directory for User - H:
echo %homedir%
Net use H: %homedir% > nul

xcopy C:\aspen\Home95.bat %Windir%\"Start Menu"\Programs\Startup\*.* /E /I /Y >nul
Goto ENDCOMMON

:ENDCOMMON
@Echo ..........
Echo Sychronize time on workstation to master time server - HQMAINDC1
Net time \\HQMAINDC1 /Set /Y >nul

@Echo aspen Windows 2000 Logon Process Version 1.2 Complete
Exit
**********************************************************

Here is the Kix Script
Shell "winset.exe USERNAME=@USERID"
Shell "Winset.exe COMPUTER=@WKSTA"
Shell "Winset.exe DOMAIN=@DOMAIN"
Shell "Winset.exe FULLNAME=@FULLNAME"
Shell "Winset.exe HOMEDIR=@HOMEDIR"
Shell "Winset.exe LSERVER=@LSERVER"
Exit



Here is the VBS script I want to add
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "Preparing to audit the machine"


'<package>
'<job id=&quot;TestXML&quot;>
'<script language=&quot;vbscript&quot;>
on error resume Next
Set objReg = WScript.CreateObject(&quot;WScript.Shell&quot;)
AUDIT = objReg.RegRead(&quot;HKEY_LOCAL_MACHINE\SOFTWARE\Blue Ocean Software, Inc.\Track-It!\Audit\data&quot;)
If err.number <> 0 then
x = &quot;1&quot;
y = err.description
z = z & &quot; regread&quot;
End If



oldRegStr = Split(audit,&quot;|&quot;)
ws = oldRegStr(0)
name = oldRegStr(1)
pos = oldRegStr(2)
dept = oldRegStr(3)
dept_num = oldRegStr(4)
phone = oldRegStr(5)
p_ext = oldRegStr(6)
modem = oldRegStr(7)
m_ext = oldRegStr(8)
fax = oldRegStr(9)
fax_ext = oldRegStr(10)
location = oldRegStr(11)
network = oldRegStr(12)
id1 = oldRegStr(13)
id2 = oldRegStr(14)
id3 = oldRegStr(15)
id4 = oldRegStr(16)
id5 = oldRegStr(17)
id6 = oldRegStr(18)
comments = oldRegStr(19)
email = oldRegStr(22)


newRegStr = ws + &quot;|&quot; + name + &quot;|&quot; + pos + &quot;|&quot; + phone + &quot;|&quot; + fax + &quot;|&quot; + fax_ext + &quot;|&quot; + p_ext + &quot;|&quot; + email + &quot;|&quot; + dept + &quot;|&quot; + dept_num + &quot;|&quot; + location + &quot;|&quot; + network + &quot;|&quot; + id1 + &quot;|&quot; + id2 + &quot;|&quot; + id3 + &quot;|&quot; + id4 + &quot;|&quot; + id5 + &quot;|&quot; + id6 + &quot;|&quot; + comments + &quot;|&quot;
If AUDIT <> &quot;&quot; then
objReg.RegWrite(&quot;HKEY_LOCAL_MACHINE\SOFTWARE\Blue Ocean Software, Inc.\Track-It!\Audit\PromptData&quot;), newRegStr

End If

on error Goto 0

'</script>

'</job>
'</package>

AA = WshNetwork.computerName
A = Len(WshNetwork.ComputerName)
If A = 7 then
C = Right(AA, 4)
'WScript.Echo C
Else
C = Right(AA, 5)
'WScript.Echo C
end If

theString = &quot;\\main2\tiw4std\audit32.exe &quot; + c
wshshell.Run &quot;command /C \\main2\tiw4std\audit32.exe TIA=&quot;+CStr(c), 6


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top