Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Powershell script runs OK on the desktop but not when it's runningunder machine startup

Reply
Thread Tools Display Modes

Powershell script runs OK on the desktop but not when it's runningunder machine startup

 
 
fortran_guy
Guest
Posts: n/a

 
      04-01-2011
Windows 7 32 bit but the intended target is a Windows Server 2008 R2
as an inbound and outbound FTP server. I've run Set-ExecutionPolicy
unrestricted, set it to run with gpedit.msc, and both RSOP.MSC and
sysinternals AUTORUNS show it running through local group
policy. .ps1 is associated with PowerShell, the script is in c:
\windows\system32\grouppolicy\machine\scripts\star tup (which I believe
is the default location) and the file even shows under the PowerShell
"Show Files" button. So what tweaks/changes/etc. am I missing.

The script is:

# Check for changes every 60 seconds
$currentFiles = Get-ChildItem D:\inetpub\ftproot\localuser\username
\UNEDITEDIMAGES
while(-1){
$newFiles = Get-ChildItem D:\inetpub\ftproot\localuser\username
\UNEDITEDIMAGES
if($newFiles.count -ne $currentFiles.count){
$currentFiles = $newFiles
(new-object Media.SoundPlayer "C:\WINDOWS\Media\notify.wav").play()
}
Start-Sleep(60)
}
 
Reply With Quote
 
 
 
 
David H. Lipman
Guest
Posts: n/a

 
      04-01-2011
From: "fortran_guy" <>

| Windows 7 32 bit but the intended target is a Windows Server 2008 R2
| as an inbound and outbound FTP server. I've run Set-ExecutionPolicy
| unrestricted, set it to run with gpedit.msc, and both RSOP.MSC and
| sysinternals AUTORUNS show it running through local group
| policy. .ps1 is associated with PowerShell, the script is in c:
| \windows\system32\grouppolicy\machine\scripts\star tup (which I believe
| is the default location) and the file even shows under the PowerShell
| "Show Files" button. So what tweaks/changes/etc. am I missing.

| The script is:

| # Check for changes every 60 seconds
| $currentFiles = Get-ChildItem D:\inetpub\ftproot\localuser\username
| \UNEDITEDIMAGES
| while(-1){
| $newFiles = Get-ChildItem D:\inetpub\ftproot\localuser\username
| \UNEDITEDIMAGES
| if($newFiles.count -ne $currentFiles.count){
| $currentFiles = $newFiles
| (new-object Media.SoundPlayer "C:\WINDOWS\Media\notify.wav").play()
| }
| Start-Sleep(60)
| }

Look at the POV the script is running under and the privileges provided.

When you run it it uses your credentials.
If it is failing it may be because of the credentials of the environment it is running
under.


--
Dave
Multi-AV Scanning Tool - http://www.pctipp.ch/downloads/dl/35905.asp


 
Reply With Quote
 
fortran_guy
Guest
Posts: n/a

 
      04-11-2011
On Apr 1, 3:05*pm, "David H. Lipman" <DLipman~nosp...@Verizon.Net>
wrote:
> From: "fortran_guy" <johngam...@gmail.com>
>
> | Windows 7 32 bit but the intended target is a Windows Server 2008 R2
> | as an inbound and outbound FTP server. *I've run Set-ExecutionPolicy
> | unrestricted, set it to run with gpedit.msc, and both RSOP.MSC and
> | sysinternals AUTORUNS show it running through local group
> | policy. *.ps1 is associated with PowerShell, the script is in c:
> | \windows\system32\grouppolicy\machine\scripts\star tup (which I believe
> | is the default location) and the file even shows under the PowerShell
> | "Show Files" button. *So what tweaks/changes/etc. am I missing.
>
> | The script is:
>
> | # Check for changes every 60 seconds
> | $currentFiles = Get-ChildItem D:\inetpub\ftproot\localuser\username
> | \UNEDITEDIMAGES
> | while(-1){
> | $newFiles = Get-ChildItem D:\inetpub\ftproot\localuser\username
> | \UNEDITEDIMAGES
> | if($newFiles.count -ne $currentFiles.count){
> | $currentFiles = $newFiles
> | (new-object Media.SoundPlayer "C:\WINDOWS\Media\notify.wav").play()
> | }
> | Start-Sleep(60)
> | }
>
> Look at the POV the script is running under and the privileges provided.
>
> When you run it it uses your credentials.
> If it is failing it may be because of the credentials of the environment it is running
> under.
>
> --
> Dave
> Multi-AV Scanning Tool -http://www.pctipp.ch/downloads/dl/35905.asp


Can't really be credentials of mine since the problem is at machine
startup with no one logged in.
Other suggestions?
 
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
Trivial startup script won't run in Vista Jeff Vandervoort Windows Vista Administration 1 10-07-2008 08:23 PM
Vista Startup Script problem (loading registry hive issue) ejmichaud@hotmail.com Windows Vista Administration 5 03-11-2008 11:27 AM
No Desktop on Vista startup Bob Raney Windows Vista Performance 7 11-02-2007 09:36 AM
Windows Desktop Startup Error Help!!! Con Windows Vista Performance 3 10-22-2007 01:42 PM
Desktop Blink at Startup - ANNOYING frustratedguy Windows Vista Performance 5 05-25-2007 07:22 AM



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