Here's the command line I use in the lab within a package/program for PS 
scripts run in SCCM on 64bit Win7/8/8.1 clients and works fine.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile 
-WindowStyle Hidden -File C:\temp\wotevs.ps1

cheers

Phil

From: [email protected] [mailto:[email protected]] On 
Behalf Of Kent, Mark
Sent: 06 January 2015 15:18
To: [email protected]
Subject: [mssms] Deploy PowerShell script

We are running SCCM 2012 R2 CU1 with Windows 7 64bit clients.  I have a simple 
script that I am trying to deploy as a package/program.  The command line is:

%WINDIR%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy 
Bypass -file .\Remove2010LNK.PS1

If I manually run the script from within powershell, it works fine.  If I 
deploy it from SCCM, it says it runs successfully but I can tell it does not, 
and it also completes in seconds when it should take a couple minutes.  I've 
tried sending it out via a task sequence with the same result, it says it runs 
successfully but it isn't.  The only odd thing I noted in the EXECMGR log is:

Running "C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe" 
-executionpolicy Bypass -file .\Remove2010LNK.PS1 with 32bitLauncher

Should it still state "with 32bitlauncher" if I am telling it to use the 64bit 
one?

My last recourse may be to take the script lines and shove it into a CMD batch 
file, but I'd really like to figure out why this isn't working.  Thanks.

Mark Kent (MCP)
Sr. Desktop Systems Engineer
Computing & Technology Services - SUNY Buffalo State





Reply via email to