I have a program I want to copy to a number of computers, but first I want powershell to determine OS Architecture, and copy over the appropriate program for that OS before execution.
I just have this at the moment:
$Computers = Get-Content -path C:\Share\Computerlist.txt
$Program32 = 32bitprogram.exe
$Program64 = 64bitprogram.exe
$destination = New-Item -ItemType Directory -Path \\$Computers\C$\Test -force
$32bitSource = '\\Fileserver\sharepath\Program\32bitprogram.exe'
$64bitSource = '\\Fileserver\sharepath\Program\64bitprogram.exe'
$OSCheck = Get-Wmiobject -Computername $Computers -class Win32_OperatingSystem | Select OSArchitecture
I'm not sure how to proceed, how to take the results of the OSArchitecture, have it copy over and execute the appropriate executable.