<#
#################################################################################
## Author: BRIAN HUNTER
## Date: 8/10/2020
## Email: brian@sutechy.com
#################################################################################
DESCRIPTION: BGINFO Copy Files
#>
$Servers = Get-content c:\scripts\desktoplist.txt
# $Servers = Get-content c:\scripts\serverlist.txt
#
Foreach ($Server in $Servers) {
$Test = Test-Path -path "\\$Server\c$\BgInfoDir\"
If ($Test -eq $True) {
Write-Host "Path exists on $Server."
}
Else {
Write-Host "Path NOT exist on $Server."
$Session = New-PSSession -ComputerName "$Server" -Credential "hchent\Administrator"
New-Item -Path "C:\" -Name "BgInfoDir" -ItemType "directory"
Copy-Item "C:\BgInfoDir\Bginfo64.exe" -Destination "C:\BgInfoDir\" -FromSession $Session
Copy-Item "C:\BgInfoDir\Default-dg.bgi" -Destination "C:\BgInfoDir\" -FromSession $Session
}
}