Share via


Executing powershell ise(x86) scripts via Task Scheduler

Question

Monday, August 18, 2014 8:41 AM

hi

i have powershell script that can only run with powershell ISE(X86)

and i want to add it to Task Scheduler

but my problem is when i try to test the script using "Powershell" or "run"  before i add it to the Task Scheduler

using "powershell" i wrote :
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe -file "c:\my path\update.ps1"

 and  it only open the script in powershell ISE(X86) without Executing the script

how can i  Execute  the script not open it ??

All replies (10)

Thursday, August 21, 2014 6:51 AM âś…Answered

thanks
I didnt try your solution
but i solved the problem
it was two  step first instead of using Set-Culture
I use
$nc = New-Object Globalization.CultureInfo 'ar-kw'

then i add Type Font 'Courier New' to powershell font

in regedit.exe

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Console\TrueTypeFont

the character may not be readable in the console because they are from left to right and there are spaces between each character
but when i update my ADUC or send them to out-file they become readable

these are the references for  solution

change the CultureInfo :

http://www.vistax64.com/powershell/16358-how-do-i-explicitly-set-currentculture.html

Add Font 'Courier New' to powershell

http://silentcrash.com/2012/05/how-to-add-hebrew-to-powershell-or-command-cmd-console/


Monday, August 18, 2014 9:14 AM

This may help

http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/12/use-scheduled-tasks-to-run-powershell-commands-on-windows.aspx

http://technet.microsoft.com/en-us/library/ee176949.aspx

http://social.technet.microsoft.com/Forums/exchange/en-US/0cad57bf-1113-4622-aac3-c3278fa97d72/how-to-schedule-a-powershell-script-through-schedule-tasks?forum=exchange2010

M.


Monday, August 18, 2014 9:30 AM

C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe -file "c:\my path\update.ps1"
 
The ISE is Integrated Scripting Environment and file parameter opens the script for editing only

To run the script in powershell, run it in the powershell console.

C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -file "c:\my path\update.ps1"


Monday, August 18, 2014 9:38 AM

my problem is not in the Task Scheduler

i try this with powershell script and it work with my no problem here

but when i try to Execute  my script  using powershell ISE(X86) :

C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell_ise.exe -file "c:\my path\update.ps1"

it open the script in powershell ISE(X86) and i will have to run it manully or press F5 to Execute  the script


Monday, August 18, 2014 9:59 AM

The ISE is an editor and will not auto run the script, to autorun the script use the powershell console

powershell.exe - file "c:\my path\update.ps1"


Monday, August 18, 2014 10:18 AM

i can not use powershell console becuse

my script import data from oracle DB which contain arabic text then update the user attribute in ADUC  

and powershell convert Arabic text to symbols

that why i used powershell ise


Monday, August 18, 2014 10:19 AM

i can not use powershell console becuse

my script import data from oracle DB which contain arabic text then update the user attribute in ADUC 

and powershell convert Arabic text to symbols

that why i used powershell ise


Monday, August 18, 2014 11:03 AM

Get-Culture
http://technet.microsoft.com/en-us/library/hh849930.aspx

CultureInfo Class
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(v=vs.110).aspx

Set-Culture
http://technet.microsoft.com/en-us/library/hh852137.aspx


Tuesday, August 19, 2014 6:14 AM

hi

i Try to Set-Culture ar-KW
but its still in  en-US
nothing changed


Tuesday, August 19, 2014 7:40 AM

set-winsystemlocale ar-KW
restart-computerAfter the computer restarts, go into powershell (characters are English but bold-like)get-winsystemlocale returns ar-KW(get-host).CurrentCulture indicates en-US
Control Panel indicates en-USMaybe that will work for you.If not, it is beyond me, I only know and use en-US.Ask a new question, about how to add a language to the Powershell consoleThis is no longer about the task manager and the ISE