Hey,
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”
If(!(test-path $path))
{
New-Item -ItemType Directory -Force -Path $path
}
$Source = “\192.168.1.1\TEST”
$Destination = "D:\install\support\logon\Scripts"
$ExcludeItems = @()
if (Test-Path “$Destination*.dli”)
{
$ExcludeItems += “*.dli”
}
Copy-Item “$Source*” -Destination “$Destination” -Exclude $ExcludeItems -Recurse -Force