Documentation
¶
Overview ¶
Package osinfo identifies the running Windows OS the way classic login scripts did — by reading a handful of registry values and classifying them — but returns one typed Info instead of a pile of ad-hoc string compares scattered across a script.
The reads are Windows-only (Detect returns ErrUnsupportedPlatform elsewhere), but the classification logic is pure and platform-independent, so the interesting decisions are unit-tested everywhere.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedPlatform = errors.New("winadmin/osinfo: only supported on Windows")
ErrUnsupportedPlatform is returned by Detect off Windows.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
ProductName string // e.g. "Windows 10 Pro" / "Windows Server 2019 Standard"
EditionID string // e.g. "Professional", "ServerStandard"
DisplayVersion string // e.g. "22H2" (ReleaseId on older builds)
Major, Minor int // e.g. 10, 0 (0 on pre-Windows-10 builds that lack the value)
Build int // e.g. 22621
UBR int // update build revision (the ".1702" in 10.0.22621.1702)
Arch string // normalized: "amd64", "x86", "arm64"
Role Role
TerminalServer bool // true when this is an RDS/Citrix application host (multi-user)
}
Info is a structured description of the OS.
func Detect ¶
Detect reads the OS information from the registry. Off Windows it returns ErrUnsupportedPlatform.
func (Info) IsDomainController ¶
IsDomainController reports whether this box is a DC.
func (Info) IsRDSHost ¶
IsRDSHost reports whether this is a multi-user Remote Desktop Session Host — the modern read of the old session-host check (a server in TS application mode).