Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

SOLVED can't copy file with powershell

Status
Not open for further replies.

Alexandre75

New Member
Messages
4
Reaction score
0
Points
1
Hi,

I Have 1706 sccm version and i want use a simple file copy.

My powershell command :

Code:
$path = "\\xxx\x$\xxx\xxx\xxx\license.xml"
$destination = "C:\ProgramData\xxx"
Copy-Item -path $path -Destination $destination

On my computer it work perfectly but when i insert this command in script section on sccm and after that i launch it, the script doesn't work.

on my computer target i finded "scripts.log" when i open this log i can saw that.

Code:
Executing command line: "C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe" -NoProfile -ExecutionPolicy RemoteSigned -File "C:\Windows\CCM\ScriptStore\B56B06D6-D2F8-416C-B994-AB5152D505C1_98D92EF42358F2B1B9D4AEF779C4FA13A3461CB2A3B64ECE233B58F1FE5957CE.ps1"

Code:
Process completed with exit code 0


Anyone can help me ? thank you

Sorry for my english i'm not very good.

best regards
 
Hi Alexandre75,

Create an empty package with a program containing the commandline of the script to be run from a share, the script
is executed using the local system account of the client computer if run with administrative permissions. So the permissions on the share must allow for "Domain computers" to have read access otherwise it cannot access to the script.

Then deploy it to a collection.
ps1.jpg
 
Its recommended to use an environment variables for determining the destination path, for example:
  • %PROGRAMFILES(X86)%
  • %PROGRAMFILES%
 
Hum... i understan but can i configure sccm for using network admin account and not local admin account ?

The Network Access account is never used as the security context for running programs, installing software updates, or running task sequences, only for accessing resources on the network.
 
Status
Not open for further replies.
Back
Top