Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Define the target remote machine
- $remoteComputer = "RemoteMachineName" # Replace with the target machine's name or IP
- # Define the registry paths for Office bitness
- $officePaths = @(
- "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration",
- "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\InstallRoot",
- "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Office\16.0\Common\InstallRoot"
- )
- # Function to check Office bitness
- function Get-OfficeBitness {
- param (
- [string]$computerName
- )
- Invoke-Command -ComputerName $computerName -ScriptBlock {
- param ($paths)
- foreach ($path in $paths) {
- if (Test-Path $path) {
- $bitness = Get-ItemProperty -Path $path | Select-Object -ExpandProperty Bitness -ErrorAction SilentlyContinue
- if ($bitness) {
- return $bitness
- }
- }
- }
- return "Office not found or Bitness not detected."
- } -ArgumentList $officePaths
- }
- # Call the function and display results
- $bitness = Get-OfficeBitness -computerName $remoteComputer
- Write-Host "Microsoft Office on $remoteComputer is $bitness." -ForegroundColor Green
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement