function Get-MyDate{
[CmdletBinding()]
param(
[Parameter(Mandatory=$True,
ValueFromPipeLine=$True,
ValueFromPipeLineByPropertyName=$True,
HelpMessage="ComputerName or IP Address to query via WMI")]
[string[]]$ComputerName
)
foreach($computer in $computerName){
$timeZone=Get-WmiObject -Class win32_timezone -ComputerName $computer
$localTime = Get-WmiObject -Class win32_localtime -ComputerName $computer
$output =@{'ComputerName' = $localTime.__SERVER;
'Current Time' = (Get-Date -Day $localTime.Day -Month $localTime.Month);
}
$object = New-Object -TypeName PSObject -Property $output
Write-Output $object
}
}
get-mydate -ComputerName MyComputerName
Recent Comments