![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Can only execute gpg from powershell under MY account I've built a powershell script that calls gpg and encrypts a file. Basically, when I run the script in the powershell window, it runs and encrypts the file. When I run it from Task Scheduler under ANY ACCOUNT other than my own (even local admin), the encrypt doesn't work. Unfortunately, gpg doesn't have a logging mechanism so I can't see what it's actually doing and the Event log doesn't help either. In the task manager, I don't see gpg.exe popping up in either case, but maybe the task manager refresh is too slow? I do see "dwm.exe" come up when run under my account and not an admin. I checked all permissions using cacls and my account doesn't come up anywhere on its own, so it doesn't appear to be an issue where just my user has access to something. What should I try next? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Can only execute gpg from powershell under MY account On Jan 23, 11:58*am, Blargh <kri...@xxxxxx> wrote: Quote: > I've built a powershell script that calls gpg and encrypts a file. > Basically, when I run the script in the powershell window, it runs and > encrypts the file. *When I run it from Task Scheduler under ANY > ACCOUNT other than my own (even local admin), the encrypt doesn't > work. *Unfortunately, gpg doesn't have a logging mechanism so I can't > see what it's actually doing and the Event log doesn't help either. > In the task manager, I don't see gpg.exe popping up in either case, > but maybe the task manager refresh is too slow? *I do see "dwm.exe" > come up when run under my account and not an admin. > I checked all permissions using cacls and my account doesn't come up > anywhere on its own, so it doesn't appear to be an issue where just my > user has access to something. > > What should I try next? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Can only execute gpg from powershell under MY account What you actually run in Task Scheduler and how (show us full command line string)? -- WBR, Vadims Podans PowerShell blog - www.sysadmins.lv "Blargh" <kripes@xxxxxx> rakstīja ziņojumā "news:94455d73-0db4-476f-8c34-85e89c134d71@xxxxxx"... Quote: > On Jan 23, 11:58 am, Blargh <kri...@xxxxxx> wrote: Quote: >> I've built a powershell script that calls gpg and encrypts a file. >> Basically, when I run the script in the powershell window, it runs and >> encrypts the file. When I run it from Task Scheduler under ANY >> ACCOUNT other than my own (even local admin), the encrypt doesn't >> work. Unfortunately, gpg doesn't have a logging mechanism so I can't >> see what it's actually doing and the Event log doesn't help either. >> In the task manager, I don't see gpg.exe popping up in either case, >> but maybe the task manager refresh is too slow? I do see "dwm.exe" >> come up when run under my account and not an admin. >> I checked all permissions using cacls and my account doesn't come up >> anywhere on its own, so it doesn't appear to be an issue where just my >> user has access to something. >> >> What should I try next? > I should mention I'm running Windows 2008. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Can only execute gpg from powershell under MY account On Jan 23, 1:49*pm, "Vadims Podans" <vpodans> wrote: Quote: > What you actually run in Task Scheduler and how (show us full command line > string)? > > -- > WBR, Vadims Podans > PowerShell blog -www.sysadmins.lv > > "Blargh" <kri...@xxxxxx> rakstīja ziņojumā > "news:94455d73-0db4-476f-8c34-85e89c134d71@xxxxxx".... > Quote: > > On Jan 23, 11:58 am, Blargh <kri...@xxxxxx> wrote: Quote: > >> I've built a powershell script that calls gpg and encrypts a file. > >> Basically, when I run the script in the powershell window, it runs and > >> encrypts the file. When I run it from Task Scheduler under ANY > >> ACCOUNT other than my own (even local admin), the encrypt doesn't > >> work. Unfortunately, gpg doesn't have a logging mechanism so I can't > >> see what it's actually doing and the Event log doesn't help either. > >> In the task manager, I don't see gpg.exe popping up in either case, > >> but maybe the task manager refresh is too slow? I do see "dwm.exe" > >> come up when run under my account and not an admin. > >> I checked all permissions using cacls and my account doesn't come up > >> anywhere on its own, so it doesn't appear to be an issue where just my > >> user has access to something. Quote: Quote: > >> What should I try next? Quote: > > I should mention I'm running Windows 2008. > # Input: Required: mydir, which is the directory that the source files are in. It is also used to determine # the destination dir. Therefore, both must be identical. ie "filedir\subdir" (without quotes!) # Grab passed in variable $mydir = $args[0] $sourcedir = "c:\outbound\myproject\my\" + $mydir + "\*.*" $filearray = get-item $sourcedir if ($filearray.length -gt 0) { # mysys is the ID for the pgp key $filearray | foreach-object { c:\dev\gpg\gpg.exe --encrypt -- recipient mysys $_ } # Copy source files to archive folder copy-item c:\outbound\myproject\my\$mydir\*.* -destination c:\outbound \myproject\my\archive\$mydir # Move encrypted files to ftp move-item -path c:\outbound\myproject\my\$mydir\*.gpg -destination \ \serverftp\ftp$\1234\$mydir # Remove all leftover files (for a clean run next time) remove-item -path c:\outbound\myproject\my\$mydir\*.* -force } else {"There are no files to process"} |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Can only execute gpg from powershell under MY account On Jan 23, 1:49*pm, "Vadims Podans" <vpodans> wrote: Quote: > What you actually run in Task Scheduler and how (show us full command line > string)? > > -- > WBR, Vadims Podans > PowerShell blog -www.sysadmins.lv > > "Blargh" <kri...@xxxxxx> rakstīja ziņojumā > "news:94455d73-0db4-476f-8c34-85e89c134d71@xxxxxx".... > Quote: > > On Jan 23, 11:58 am, Blargh <kri...@xxxxxx> wrote: Quote: > >> I've built a powershell script that calls gpg and encrypts a file. > >> Basically, when I run the script in the powershell window, it runs and > >> encrypts the file. When I run it from Task Scheduler under ANY > >> ACCOUNT other than my own (even local admin), the encrypt doesn't > >> work. Unfortunately, gpg doesn't have a logging mechanism so I can't > >> see what it's actually doing and the Event log doesn't help either. > >> In the task manager, I don't see gpg.exe popping up in either case, > >> but maybe the task manager refresh is too slow? I do see "dwm.exe" > >> come up when run under my account and not an admin. > >> I checked all permissions using cacls and my account doesn't come up > >> anywhere on its own, so it doesn't appear to be an issue where just my > >> user has access to something. Quote: Quote: > >> What should I try next? Quote: > > I should mention I'm running Windows 2008. > of "c:\scripts\myscript.ps1" (with quotes) |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Can only execute gpg from powershell under MY account I see $args[0] variable in script (where you pass a path to script). However in call line you don't pass any data to script. Here should be something like this: C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe "c:\scripts\myscript.ps1 data" where Data - your data that will passed as $args[0]. -- WBR, Vadims Podans PowerShell blog - www.sysadmins.lv "Blargh" <kripes@xxxxxx> rakstīja ziņojumā "news:0baaed59-69f9-4e1a-b66e-e44ea0ce57db@xxxxxx"... Quote: > On Jan 23, 1:49 pm, "Vadims Podans" <vpodans> wrote: Quote: >> What you actually run in Task Scheduler and how (show us full command >> line >> string)? >> >> -- >> WBR, Vadims Podans >> PowerShell blog -www.sysadmins.lv >> >> "Blargh" <kri...@xxxxxx> rakstīja ziņojumā >> "news:94455d73-0db4-476f-8c34-85e89c134d71@xxxxxx"... >> Quote: >> > On Jan 23, 11:58 am, Blargh <kri...@xxxxxx> wrote: >> >> I've built a powershell script that calls gpg and encrypts a file. >> >> Basically, when I run the script in the powershell window, it runs and >> >> encrypts the file. When I run it from Task Scheduler under ANY >> >> ACCOUNT other than my own (even local admin), the encrypt doesn't >> >> work. Unfortunately, gpg doesn't have a logging mechanism so I can't >> >> see what it's actually doing and the Event log doesn't help either. >> >> In the task manager, I don't see gpg.exe popping up in either case, >> >> but maybe the task manager refresh is too slow? I do see "dwm.exe" >> >> come up when run under my account and not an admin. >> >> I checked all permissions using cacls and my account doesn't come up >> >> anywhere on its own, so it doesn't appear to be an issue where just my >> >> user has access to something. Quote: >> >> What should I try next? Quote: >> > I should mention I'm running Windows 2008. >> > Oh, and Task Scheduler runs "powershell" (no quotes) with an argument > of "c:\scripts\myscript.ps1" (with quotes) |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Can only execute gpg from powershell under MY account On Jan 23, 5:15 pm, "Vadims Podans" <vpodans> wrote: Quote: > I see $args[0] variable in script (where you pass a path to script). However > in call line you don't pass any data to script. Here should be something > like this: > C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe > "c:\scripts\myscript.ps1 data" > > where Data - your data that will passed as $args[0]. > > -- > WBR, Vadims Podans > PowerShell blog -www.sysadmins.lv > > "Blargh" <kri...@xxxxxx> rakstīja ziņojumā > "news:0baaed59-69f9-4e1a-b66e-e44ea0ce57db@xxxxxx".... > Quote: > > On Jan 23, 1:49 pm, "Vadims Podans" <vpodans> wrote: Quote: > >> What you actually run in Task Scheduler and how (show us full command > >> line > >> string)? Quote: Quote: > >> -- > >> WBR, Vadims Podans > >> PowerShell blog -www.sysadmins.lv Quote: Quote: > >> "Blargh" <kri...@xxxxxx> rakstīja ziņojumā > >> "news:94455d73-0db4-476f-8c34-85e89c134d71@xxxxxx"... Quote: Quote: > >> > On Jan 23, 11:58 am,Blargh<kri...@xxxxxx> wrote: > >> >> I've built a powershell script that calls gpg and encrypts a file. > >> >> Basically, when I run the script in the powershell window, it runs and > >> >> encrypts the file. When I run it from Task Scheduler under ANY > >> >> ACCOUNT other than my own (even local admin), the encrypt doesn't > >> >> work. Unfortunately, gpg doesn't have a logging mechanism so I can't > >> >> see what it's actually doing and the Event log doesn't help either. > >> >> In the task manager, I don't see gpg.exe popping up in either case, > >> >> but maybe the task manager refresh is too slow? I do see "dwm.exe" > >> >> come up when run under my account and not an admin. > >> >> I checked all permissions using cacls and my account doesn't come up > >> >> anywhere on its own, so it doesn't appear to be an issue where justmy > >> >> user has access to something. Quote: Quote: > >> >> What should I try next? Quote: Quote: > >> > I should mention I'm running Windows 2008. Quote: > > Oh, and Task Scheduler runs "powershell" (no quotes) with an argument > > of "c:\scripts\myscript.ps1" (with quotes) \myscript.ps1 parentdir\childdir" I figured out the problem. gpg imports keys for use only on a per- user basis. So I had to log on as the other user and re-import they key. In addition, some directories on the server were not accessible for file deletion by my script under ANY account (even though they had access in the security tab). So I changed the task to run under the highest privileges. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to execute external program from powershell | PowerShell | |||
| Execute a powershell script from a webpage | PowerShell | |||
| How to execute a webtest from Powershell | PowerShell | |||
| Powershell Execute process | PowerShell | |||
| How to execute (perl) scripts in Powershell without DOS box | PowerShell | |||