I am trying to create a couple lines of code that will pull from WMI if a machine is either 32/64 bit and then if it is 64 do this .... if it is 32bit do this...
Can
if($env:PROCESSOR_ARCHITECTURE -eq "x86"){"32-Bit CPU"}Else{"64-Bit CPU"}
-edit, sorry forgot to include more code to explain the usage.
if($env:PROCESSOR_ARCHITECTURE -eq "x86")
{
#If the powershell console is x86, create alias to run x64 powershell console.
set-alias ps64 "$env:windir\sysnative\WindowsPowerShell\v1.0\powershell.exe"
$script2=[ScriptBlock]::Create("#your commands here, bonus is the script block expands variables defined above")
ps64 -command $script2
}
Else{
#Otherwise, run the x64 commands.