Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Script on Machine Startup GPO

HTVi
TV Discussion Newsgroups

Script on Machine Startup GPO
"Ed" <edvin[ at ]edloci.com> 10/30/2008 3:01:46 PM
Have a Machine Startup Script configured on GPO. I need to run the windows
"Uptime" command and
email the result. When I run the script manually it runs fine, on startup it
doesn't run (GPO times out).
The Authenticated Users and Domain Computers have Full access on the script
folder.

Is it because of Uptime ? How can I run this on Startup ?


Script is something like this:

strRun="%logonserver%\NETLOGON\uptime /s /p:30"
Set objScriptExec = objShell.Exec(strRun)
strUptimeResult = replace(objScriptExec.StdOut.ReadAll,vbNewLine,"<br>")

email strUptimeResult

Re: Script on Machine Startup GPO
"Pegasus \(MVP\)" <I.can[ at ]fly.com.oz> 10/30/2008 4:45:48 PM

"Ed" <edvin[ at ]edloci.com> wrote in message
news:eN8YvBqOJHA.1744[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text]
> Have a Machine Startup Script configured on GPO. I need to run the windows
> "Uptime" command and
> email the result. When I run the script manually it runs fine, on startup
> it doesn't run (GPO times out).
> The Authenticated Users and Domain Computers have Full access on the
> script folder.
>
> Is it because of Uptime ? How can I run this on Startup ?
>
>
> Script is something like this:
>
> strRun="%logonserver%\NETLOGON\uptime /s /p:30"
> Set objScriptExec = objShell.Exec(strRun)
> strUptimeResult = replace(objScriptExec.StdOut.ReadAll,vbNewLine,"<br>")
>
> email strUptimeResult

I would start with a simple command, then build it up until the script
fails, e.g. like so:

Step 1: strRun="c:\windows\system32\cmd.exe /c echo %time% >> c:\test.txt"

Step 2: strRun="c:\uptime.exe /s /p:30 >> c:\test.txt"
(You need to copy uptime.exe to c:\)

Step 3: strRun="%logonserver%\NETLOGON\\cmd.exe /c echo %time% >>
c:\test.txt"
(you need to copy cmd.exe to your netlogon share)

Step 4: strRun="%logonserver%\NETLOGON\uptime /s /p:30"

In each case you must replace the line
Set objScriptExec = objShell.Exec(strRun)
with
objShell.run strRun , 1, true
in order for the tests to work. By making a note of the step that fails you
can probably resolve the issue.


Re: Script on Machine Startup GPO
harrykrishna.nospam[ at ]online.ie 11/1/2008 3:06:33 PM
I'd be wary of the line where you have %logonserver% as I'm not sure
that variable is present under the computer context.

Try replacing that with \\<domain.server.name>\netlogon (after testing
the line manually again) and see if any better luck...



"Ed" <edvin[ at ]edloci.com> wrote:

[Quoted Text]
>Have a Machine Startup Script configured on GPO. I need to run the windows
>"Uptime" command and
>email the result. When I run the script manually it runs fine, on startup it
>doesn't run (GPO times out).
>The Authenticated Users and Domain Computers have Full access on the script
>folder.
>
>Is it because of Uptime ? How can I run this on Startup ?
>
>
>Script is something like this:
>
>strRun="%logonserver%\NETLOGON\uptime /s /p:30"
>Set objScriptExec = objShell.Exec(strRun)
>strUptimeResult = replace(objScriptExec.StdOut.ReadAll,vbNewLine,"<br>")
>
>email strUptimeResult
Re: Script on Machine Startup GPO
"Ed" <edvin[ at ]edloci.com> 11/6/2008 5:46:03 PM
Changing %logonserver% with the <domainname> fixed it.
Looks like Windows configures these vars after logging on.

Thanks
Ed



<harrykrishna.nospam[ at ]online.ie> wrote in message
news:burog4h10g6v7c5j3il7urakdghiqgk2p4[ at ]4ax.com...
[Quoted Text]
> I'd be wary of the line where you have %logonserver% as I'm not sure
> that variable is present under the computer context.
>
> Try replacing that with \\<domain.server.name>\netlogon (after testing
> the line manually again) and see if any better luck...
>
>
>
> "Ed" <edvin[ at ]edloci.com> wrote:
>
>>Have a Machine Startup Script configured on GPO. I need to run the windows
>>"Uptime" command and
>>email the result. When I run the script manually it runs fine, on startup
>>it
>>doesn't run (GPO times out).
>>The Authenticated Users and Domain Computers have Full access on the
>>script
>>folder.
>>
>>Is it because of Uptime ? How can I run this on Startup ?
>>
>>
>>Script is something like this:
>>
>>strRun="%logonserver%\NETLOGON\uptime /s /p:30"
>>Set objScriptExec = objShell.Exec(strRun)
>>strUptimeResult = replace(objScriptExec.StdOut.ReadAll,vbNewLine,"<br>")
>>
>>email strUptimeResult

Re: Script on Machine Startup GPO
harrykrishna.nospam[ at ]online.ie 11/8/2008 5:28:17 PM
Glad to hear it's fixed.

Thanks for letting us know.

"Ed" <edvin[ at ]edloci.com> wrote:

[Quoted Text]
>Changing %logonserver% with the <domainname> fixed it.
>Looks like Windows configures these vars after logging on.
>
>Thanks
>Ed
>
>
>
><harrykrishna.nospam[ at ]online.ie> wrote in message
>news:burog4h10g6v7c5j3il7urakdghiqgk2p4[ at ]4ax.com...
>> I'd be wary of the line where you have %logonserver% as I'm not sure
>> that variable is present under the computer context.
>>
>> Try replacing that with \\<domain.server.name>\netlogon (after testing
>> the line manually again) and see if any better luck...
>>
>>
>>
>> "Ed" <edvin[ at ]edloci.com> wrote:
>>
>>>Have a Machine Startup Script configured on GPO. I need to run the windows
>>>"Uptime" command and
>>>email the result. When I run the script manually it runs fine, on startup
>>>it
>>>doesn't run (GPO times out).
>>>The Authenticated Users and Domain Computers have Full access on the
>>>script
>>>folder.
>>>
>>>Is it because of Uptime ? How can I run this on Startup ?
>>>
>>>
>>>Script is something like this:
>>>
>>>strRun="%logonserver%\NETLOGON\uptime /s /p:30"
>>>Set objScriptExec = objShell.Exec(strRun)
>>>strUptimeResult = replace(objScriptExec.StdOut.ReadAll,vbNewLine,"<br>")
>>>
>>>email strUptimeResult

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen