Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

134 lines (112 sloc) 6.33 KB
<#
.SYNOPSIS
Display custom IPsec policy configuration for VPN connections.
.PARAMETER Connection
Name of the VPN connection to view custom IPsec policy.
.EXAMPLE
.\Show-VpnConnectionIpsecConfiguration.ps1 -Connection 'Always On VPN'
Displays the custom IPsec policy for the VPN connection, if configured.
.DESCRIPTION
Windows does not provide the ability to view custom IPsec policy configuration in the UI.
In addition, Windows does not provide a native PowerShell command to view these settings.
This script gives administrators the ability to easily view configured IPsec policy settings.
.LINK
https://directaccess.richardhicks.com/2018/12/10/always-on-vpn-ikev2-security-configuration/
.NOTES
Version: 1.0
Creation Date: August 20, 2019
Last Updated: August 20, 2019
Author: Richard Hicks
Organization: Richard M. Hicks Consulting, Inc.
Contact: rich@richardhicks.com
Web Site: www.richardhicks.com
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory = $True, HelpMessage = "Enter the name of the VPN connection.")]
[string]$Connection
)
$Vpn = Get-VpnConnection -Name $Connection -ErrorAction SilentlyContinue
If ($Vpn -eq $null) {
Write-Warning "The VPN connection $Connection does not exist. Exiting script."
Exit
}
$Policy = ($Vpn | Select-Object -ExpandProperty IPsecCustomPolicy)
If ($Policy -eq $null) {
Write-Warning 'Custom IPsec policy not configured.'
Exit
}
Write-Output $Policy
# SIG # Begin signature block
# MIINRAYJKoZIhvcNAQcCoIINNTCCDTECAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUGneGm/HQms+qi61CfRjsgjrV
# e5OgggqGMIIFMDCCBBigAwIBAgIQBAkYG1/Vu2Z1U0O1b5VQCDANBgkqhkiG9w0B
# AQsFADBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYD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zAaTbBAE0aIQJlJ5j4F+I/vD1ta28Nu
# bFJTdd0M5CwCCohjBafTxmajpJ8rJKiZ5YBitK/u0ISzP1ZxRy/b7UQ1e1KnCF+2
# BCdEtUAQRD7I17pt0pKpnN8k1k2yCFE8z90s0lEwGd4N2cagMyTakQ==
# SIG # End signature block
You can’t perform that action at this time.