I often saw scripts that did something like this function test1 {
param (
[string] $computername
)
if ( ! $computername ) {
$computername = $env:COMPUTERNAME
}
Get-WmiObject -Class Win32_OperatingSystem -ComputerName $computername… Read the full text.