Get-WindowsPowerShellVersion.ps1


<#PSScriptInfo
 
.VERSION 1.0
 
.GUID b587c363-bef2-402b-8a52-8202a61ee7c6
 
.AUTHOR saw-friendship
 
.COMPANYNAME
 
.COPYRIGHT saw-friendship
 
.TAGS saw-friendship Windows Remote PowerShell Version
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
 
 
#>


<#
 
.DESCRIPTION
 Get Windows PowerShell Version on local and remote system
 
.LINK
 https://sawfriendship.wordpress.com/
 
.EXAMPLE
 Get-WindowsPowerShellVersion
 
.EXAMPLE
 Get-WindowsPowerShellVersion FileServer01 -Credential (Get-Credential)
 
.EXAMPLE
 Get-WindowsPowerShellVersion FileServer01,FileServer02
  
 
#>
 

[CmdletBinding()]
    param(
        [Parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)][Alias("Host","DNSHostName","IP","IPAddress")][string[]]$ComputerName = $env:COMPUTERNAME,
        [PSCredential]$Credential
    )
    if($Credential){
        Invoke-AsWorkflow -Expression {$PSVersionTable.PSVersion} -PSComputerName $ComputerName -PSCredential $Credential
    } else {
        Invoke-AsWorkflow -Expression {$PSVersionTable.PSVersion} -PSComputerName $ComputerName
    }