Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Script on Machine Startup GPO

Reply
Thread Tools Display Modes

Script on Machine Startup GPO

 
 
Ed
Guest
Posts: n/a

 
      10-30-2008
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,"<b r>")

email strUptimeResult

 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      10-30-2008

"Ed" <> wrote in message
news:...
> 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,"<b r>")
>
> 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.


 
Reply With Quote
 
harrykrishna.nospam@online.ie
Guest
Posts: n/a

 
      11-01-2008
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" <> 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,"<b r>")
>
>email strUptimeResult

 
Reply With Quote
 
Ed
Guest
Posts: n/a

 
      11-06-2008
Changing %logonserver% with the <domainname> fixed it.
Looks like Windows configures these vars after logging on.

Thanks
Ed



<> wrote in message
news:...
> 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" <> 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,"<b r>")
>>
>>email strUptimeResult


 
Reply With Quote
 
harrykrishna.nospam@online.ie
Guest
Posts: n/a

 
      11-08-2008
Glad to hear it's fixed.

Thanks for letting us know.

"Ed" <> wrote:

>Changing %logonserver% with the <domainname> fixed it.
>Looks like Windows configures these vars after logging on.
>
>Thanks
>Ed
>
>
>
><> wrote in message
>news:.. .
>> 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" <> 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,"<b r>")
>>>
>>>email strUptimeResult

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Machine startup GPO Jimmy Windows Vista General Discussion 0 09-24-2008 05:33 AM
How to run a WSH script as a startup script &| from command line Ehren Active Directory 0 10-03-2007 07:19 PM
Startup Script or Login Script ?? WANNABE Active Directory 5 12-22-2006 01:14 PM
machine startup scripts steve Windows Server 0 08-30-2004 05:08 PM
Add printer - machine startup script cheech Scripting 2 01-18-2004 06:44 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59