Help getting a Powershell script to execute through SCCM 2012

Hello SCCM Experts,

We are running SCCM 2012.  I have a PowerShell script that simply creates a folder called PSTest on the C drive of a computer.  I want to push this out via SCCM.  Here are the steps I’m going in trying to get this script to run via SCCM:
1.      Log into SCCM server.
2.      Open Configuration Manager.
3.      Navigate to Software Library.
4.      Navigate to Application Management.
5.      Navigate to Packages.
6.      Select the Create Package option.
7.      Create a new package with the following options:
Package Info Screen
a.      Name = SCCM-Powershell Test
b.      Language = English
c.      Version = 1
d.      Check mark in the ‘This package contains source files’ box
e.      Source folder = \\server1\ws_psscripts
Program Type Screen
a.      Select ‘Standard Program’
Standard Program Info Screen
a.      Name = PackageTest
b.      Command line:  powershell.exe –executionpolicy bypass –file \\server1\ws_psscripts\packagetest.ps1
c.      Run = Normal
d.      Program can run = Whether or not user is logged on
e.      Run mode:  Run with admin rights
f.      Drive mode = Runs with UNC name
Specify requirements Screen
a.      This program can only run on specified platforms selected, All Windows 7 (64-bit specified)

The package is created successfully.  I then right-click the package and select the ‘Distribute Content’ option.  I add my distribution point and successfully distribute the content.

Once the content is distributed, I right-click the package and select the ‘Deploy’ option.
            General Info Screen
a.      Select my test collection.
Content Destination Page
a.      Verify my distribution point is showing
How Software Deployed Screen
a.      Purpose = Required
b.      Check mark in ‘Send Wake-up packets’
Schedule For Deployment Page
New assignment schedule for made for ‘As soon as possible’ assignment

Once all this has been configured, I wait about 30 minutes and check in with SCCM.  At this point the deployment is showing 100% successful, however when I check my test machine the directory the script should have created is not there.  Can anyone see what I’m doing wrong?

Thanks,
Nick
LVL 1
ndalmolin_13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ganesh Kumar ASr Infrastructure SpecialistCommented:
Perhaps copy locally and try if that is running on the win 7 workstation. May be you need to copy locally and run the powershell script
ndalmolin_13Author Commented:
I don't really want to copy the script to the local PC.
aravind ancheWindows/Vmware Commented:
What should powershell script do.
What are trying to accomplish?
ndalmolin_13Author Commented:
The powershell script just creates a folder.  What I'm really trying to do is figure out how to make an SCCM package that runs a Powershell script.
Pankaj KumarSystems SpecialistCommented:
If you want to execute it from share folder  \\server1\ws_psscripts\packagetest.ps1.

1. Try to give read access to everyone on this folder. because SCCm agent will execute this script with System Account.
3. Make sure network level access on port 445 is in place from SCCM client to share server1.
2. Also refer Execmgt.log file for any kind of error for sccm package deployment.
 

Also you dont need to give Source folder = \\server1\ws_psscripts if you dont want script to be downloaded on clients.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.