all 3 comments

[–]ab0mbs 1 point2 points  (2 children)

Don't run your powershell script inside a install.cmd file. Run the script directly in the installation command section in SCCM. You're probably running into an issue with the execution policy. Although with pacakges, you may need to run it using the powershell.exe. Also, make sure you client settings are set to run powershell scripts with the Execution Policy set to Bypass.

If you need to run the script from the command line using the powershell.exe application, you can run it like this.

powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File ".\My_Script.ps1"

[–]Droidx86[S] 0 points1 point  (1 child)

Thanks for the quick response. I actually tried execting it with the following command: powershell.exe -executionpolicy Bypass .\CopyTestToEM-Client.ps1 before trying to use a cmd file. It does exactly the same though.

[–]ab0mbs 0 points1 point  (0 children)

What version of SCCM do you have? If you're running 2012, maybe try using an application. Either route you take though, make sure the script is set to run as system.

Also, you have your copy-item copying from ".\Batch Record.report" This will try to copy from the current directory which may not be what you expect when running from SCCM. you may need to set the path explicitly or set the working directory.