## Written by Jeff Harbert, 4-5-2017
## This Powershell script copies a file from a remote computer if the computer name doesn't match a specified name.
## This allows the same script to run on multiple computers when only one computer contains a 'master'
## file of some kind, simplifying script version control.
## If the names do match the local file is used, but that will only happen on the specified computer.
## Grab the computer name and assign it to a variable
$computerName = $env:computername
## Compare $computerName to a specified computer name, and copy a file if the names don't match.
## In this case, the computer name is ANTIGEN.
If ($computerName -ne "ANTIGEN")
{
Copy-Item "\\ANTIGEN\path\to\file.txt" "C:\path\to\file.txt"
}
## The rest of the script (if any) that uses file.txt goes here.
Comments