writing to a share during computer startup script
- From: cincyman12@xxxxxxxxx
- Date: 23 Sep 2005 13:10:12 -0700
Hello,
We have recently implemented a GPO with a computer startup script to
restore our required support accounts to the local administrators group
on our end user systems. The only issue I am having is writting the
audit log file on a shared drive. The script works perfectly if I run
it manually after I login in. But when utilized during the computer
startup script it does not add the entry to the log file. Below is my
script. Any help would be greatly appreciated.
Set ws = WScript.CreateObject("WScript.Shell")
strComputer = ws.ExpandEnvironmentStrings ( "%COMPUTERNAME%" )
Set objLocADMGroup = GetObject("WinNT://" & strComputer &
"/Administrators,group")
set objADMGroup = GetObject("WinNT://mydom/Domain Admins,group")
set objSvrADMGroup = GetObject("WinNT://mydom/Server Admins,group")
set objFSADMGroup = GetObject("WinNT://mydom/FieldSupp,group")
On Error Resume Next
For each objMember in objLocADMGroup.Members
if objMember.Name = objADMGroup.Name then DomainAdmin = True
if objMember.Name = objSvrADMGroup.Name then ServerAdmin= True
if objMember.Name = objFSADMGroup.Name then FieldSupp = True
Next
if ServAdmin = False then
objLocADMGroup.Add("WinNT://mydom/Server Admins,group")
End if
if DomainAdmin = False Then
objLocADMGroup.Add ("WinNT://mydom/Domain Admins,group")
End if
if FieldSupp = False then
objLocADMGroup.Add ("WINNT://mydom/FieldSupp,group")
End if
if FieldSupp = false or DomainAdmin = false then
msgbox("A Mandatory Administrative group was removed from the local
administrators group on this system. The group has been restored and
the incident logged. Please refrain from removing administrative
accounts from the system.")
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile
("\\192.168.82.231\LAL\adminremoved.log",ForAppending, True)
objTextFile.WriteLine(strComputer & " " & Date & " " & Time)
bjTextFile.Close
End If
.
- Follow-Ups:
- Re: writing to a share during computer startup script
- From: Farès GRINE
- Re: writing to a share during computer startup script
- From: Andrew Madsen
- Re: writing to a share during computer startup script
- Prev by Date: Making ADSI changes from a Web Page??
- Next by Date: Re: writing to a share during computer startup script
- Previous by thread: Making ADSI changes from a Web Page??
- Next by thread: Re: writing to a share during computer startup script
- Index(es):
Relevant Pages
|
Loading