Re: writing to a share during computer startup script



This I believe is a rights issue on the share you are attempting to write
to.

--
Andrew C. Madsen
Network Specialist
Harley-Davidson Motor Company
<cincyman12@xxxxxxxxx> wrote in message
news:1127506212.693277.319930@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> 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
>


.



Relevant Pages

  • Re: Add users to local admin via login script
    ... with Admin rights on Every PC. ... permissions denied when trying to add a user via a computer startup script. ... The Startup script should add a domain group to the local ... Administrators group, and then all the desired users can be made members ...
    (microsoft.public.windows.server.active_directory)
  • writing to a share during computer startup script
    ... We have recently implemented a GPO with a computer startup script to ... restore our required support accounts to the local administrators group ...
    (microsoft.public.scripting.vbscript)
  • Re: Change Password
    ... local Administrators group when the computer is joined to the domain. ... you would need to trap the error on the "Set objUser" statement to ... You might want to use this example VBScript program to reset the ... I will run the script via GPO in the startup script. ...
    (microsoft.public.windows.server.scripting)
  • Re: writing to a share during computer startup script
    ... > We have recently implemented a GPO with a computer startup script to ... > restore our required support accounts to the local administrators group ... > startup script it does not add the entry to the log file. ...
    (microsoft.public.scripting.vbscript)

Loading