Skip to content

Commit

Permalink
Update ./scripts/Collectors/get Domains or Workgroup name.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
P6g9YHK6 committed Dec 12, 2024
1 parent 67b3eb3 commit a0f05e8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions scripts_staging/Collectors/get Domains or Workgroup name.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<#
.SYNOPSIS
Retrieves and displays the domain or workgroup name of the computer.
.DESCRIPTION
This script checks if the computer is part of a domain or a workgroup.
If the computer is part of a domain, it outputs the domain name.
Otherwise, it outputs the workgroup name.
.NOTES
Author: SAN
Date: 01.01.24
#public
.CHANGELOG
#>

# Check if the computer is a member of a domain or workgroup
$computerInfo = Get-WmiObject Win32_ComputerSystem

if ($computerInfo.PartOfDomain -eq $true) {
Write-Host "D: $($computerInfo.Domain)"
} else {
$workgroupName = $computerInfo.Workgroup
Write-Host "W: $workgroupName"
}

0 comments on commit a0f05e8

Please sign in to comment.