Last active
November 30, 2018 18:13
-
-
Save CloudHoang/1a9844d1c907c458d4362feb7249527b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$source_path="C:\USB" #Change the path of source image file folder | |
$dest_path="D:\Wallpaper" #Change the path to shared folder where client can update wallpaper | |
$filename_fix="background.png" # File name defaut in GPO | |
# Save pictures to the correct directory | |
if( -Not (Test-Path -Path $dest_path ) ) | |
{ | |
New-Item -ItemType directory -Path $dest_path | |
Copy-Item "$source_path\photo1.png*" -Destination $dest_path | |
} | |
elseif (test-path "$dest_path\photo1.png*") | |
{ | |
Remove-Item "$dest_path\*" | |
Copy-Item "$source_path\photo2.png*" -Destination $dest_path | |
} | |
elseif (test-path "$dest_path\photo2.png*") | |
{ | |
Remove-Item "$dest_path\*" | |
Copy-Item "$source_path\photo3.png*" -Destination $dest_path | |
} | |
#return to photo1 | |
elseif (test-path "$dest_path\photo3.png*") | |
{ | |
Remove-Item "$dest_path\*" | |
Copy-Item "$source_path\photo1.png*" -Destination $dest_path | |
} | |
##### DO NOT EDIT CODE BELOW ####### | |
##### Copy file to Folder GPO ###### | |
$Path_of_file = (get-childitem $dest_path -recurse).FullName | |
Copy-Item $Path_of_file -Destination "$dest_path\$filename_fix" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment