Dictionaries/Computer.Dict.Linux/Computer.Dict.Linux.psm1
<#
###### ####### ## ## ######## ## ## ######## ######## ######## ## ## ## ## ### ### ## ## ## ## ## ## ## ## ## ## ## #### #### ## ## ## ## ## ## ## ## ## ## ## ## ### ## ######## ## ## ## ###### ######## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###### ####### ## ## ## ####### ## ######## ## ## #> <# .SYNOPSIS Get the computer name .DESCRIPTION .PARAMETER localhost request localhost's ComputerName .EXAMPLE $name = Get-ComputerName .NOTES This function comes from Dict.Unix module. #> function Get-ComputerName { [CmdletBinding()]Param ( ) Begin { Write-EnterFunction } Process { # delete everything after 1st dot to get only hostname (e.g. without domainname) return (hostname) -replace "\..*" } End { Write-LeaveFunction } } function Get-ComputerDomain { hostname -d } function Get-ComputerManufacturer { [CmdletBinding()][OutputType([String])]Param ( ) Begin { Write-EnterFunction } Process { return (New-HashtableFromCommand -Command "dmidecode | awk '/^System Information/,/^$/'" -sep ":" -SkipFirstLines 1).manufacturer } End { Write-LeaveFunction } } function Get-ComputerModel { [CmdletBinding()]Param ( ) Begin { Write-EnterFunction } Process { return (dmidecode | awk '/^System Information/,/^$/' | Select-Object -Skip 1 | ConvertFrom-StringData -Delimiter ":")."product name" # return (New-HashtableFromCommand -Command "dmidecode | awk '/^System Information/,/^$/'" -sep ":" -SkipFirstLines 1)."product name" } End { Write-LeaveFunction } } function Get-ComputerSerialNumber { [CmdletBinding()]Param ( ) Begin { Write-EnterFunction } Process { return (New-HashtableFromCommand -Command "dmidecode | awk '/^System Information/,/^$/'" -sep ":" -SkipFirstLines 1)."serial number" } End { Write-LeaveFunction } } |