I am trying create a script that copies a file from the current directory and sends it to a path. I tried to use .\ this script works if I type a the full path name. THe powershell script and the file would be in the same directory and sccm would download it locally and run it locally. The source path can not be static because the source could be different on every machine.
The script below. I changed the source path for security purposes.
path = "D:\install\support\logon\scripts"
$Source = "\\192.168.1.1\TEST"
$ExcludeItems = @()
Copy-Item "$Source\*" -Destination "$Destination" -Exclude $ExcludeItems -Recurse -Force
Just want to verify, the $Source variable is what you're trying to dot-source, right?
Let me elaborate a little more.
Instead of .\, try something like this:
$Source = Split-Path -Parent $MyInvocation.MyCommand.Path
You must be logged in to reply to this topic.