<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Powershell Script Server Error forbidden in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27063#M1562</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, did you enable the API server?&lt;/P&gt;&lt;P&gt;It's not enabled by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.checkpoint.com/legacyfs/online/checkpoint/70321_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Sep 2018 23:12:36 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2018-09-14T23:12:36Z</dc:date>
    <item>
      <title>Powershell Script Server Error forbidden</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27061#M1560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want to use the following PowerShell Script to Sync the Office 365 URLs for the Smart Dashboard, but i get a Server Error: Forbidden. I use the Checkpoint Admin User for this Task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this a Rights Problem or a Missing "Checkbox" Error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Powershell Script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&amp;lt;#&lt;/P&gt;&lt;P&gt;.SYNOPSIS&lt;BR /&gt;One way sync of Microsoft Office365 hosts &amp;amp; networks into Check Point groups.&lt;/P&gt;&lt;P&gt;.DESCRIPTION&lt;BR /&gt;This script will create/update Check Point groups for each Microsoft Office365 product, with the list of hosts &amp;amp; networks Microsoft publish.&lt;/P&gt;&lt;P&gt;.PARAMETER ManagementServer&lt;BR /&gt;IP or Hostname of the Check point Management Server&lt;/P&gt;&lt;P&gt;.PARAMETER Credentials&lt;BR /&gt;PSCredential containing User name and Password. If not provided you will be prompted.&lt;/P&gt;&lt;P&gt;.PARAMETER CertificateHash&lt;BR /&gt;The server's SSL certificate hash&lt;/P&gt;&lt;P&gt;.PARAMETER ManagementPort&lt;BR /&gt;Port Web API running on.&lt;/P&gt;&lt;P&gt;.PARAMETER NoIPv4&lt;BR /&gt;Do not include IPv4 addresses.&lt;/P&gt;&lt;P&gt;.PARAMETER NoIPv6&lt;BR /&gt;Do not include IPv6 addresses.&lt;/P&gt;&lt;P&gt;.PARAMETER Publish&lt;BR /&gt;If any changes made publish them automatically. By default session will just be closed pending you to manually open session in SmartConsole and publish the changes.&lt;BR /&gt;Publish will only happen if no errors during sync.&lt;/P&gt;&lt;P&gt;.PARAMETER Ignore&lt;BR /&gt;Weather Check Point warnings or errors should be ignored.&lt;/P&gt;&lt;P&gt;.PARAMETER Rename&lt;BR /&gt;If existing object not found by name, first search by IP/Subnet and if matching object found rename it and add to group.&lt;/P&gt;&lt;P&gt;.PARAMETER Color&lt;BR /&gt;Check Point color to set on created objects.&lt;/P&gt;&lt;P&gt;.PARAMETER Prefix&lt;BR /&gt;Prefix used on host/network objects.&lt;/P&gt;&lt;P&gt;.PARAMETER GroupPrefix&lt;BR /&gt;Prefix used on group objects.&lt;/P&gt;&lt;P&gt;.PARAMETER CommentPrefix&lt;BR /&gt;Prefix used on comments (Groups, Session, Created Hosts &amp;amp; Networks).&lt;/P&gt;&lt;P&gt;.PARAMETER Tag&lt;BR /&gt;Tag set when creating objects.&lt;/P&gt;&lt;P&gt;.PARAMETER CertificateValidation&lt;BR /&gt;Which certificate validation method(s) to use.&lt;/P&gt;&lt;P&gt;.PARAMETER Instance&lt;BR /&gt;Specifies the instance to return the endpoints for.&lt;/P&gt;&lt;P&gt;.EXAMPLE&lt;BR /&gt;./Office365_Group_Sync.ps1 -NoIPv6 -Rename -Verbose&lt;/P&gt;&lt;P&gt;.NOTES&lt;BR /&gt;Requires psCheckPoint v0.7.9+.&lt;/P&gt;&lt;P&gt;.LINK&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://github.com/tkoopman/psCheckPoint" rel="nofollow"&gt;https://github.com/tkoopman/psCheckPoint&lt;/A&gt;&lt;/P&gt;&lt;P&gt;.LINK&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://support.content.office.net/en-us/static/O365IPAddresses.xml" rel="nofollow"&gt;https://support.content.office.net/en-us/static/O365IPAddresses.xml&lt;/A&gt;&lt;/P&gt;&lt;P&gt;#&amp;gt;&lt;BR /&gt;[CmdletBinding()]&lt;BR /&gt;param(&lt;BR /&gt; [Parameter(Mandatory = $true)]&lt;BR /&gt; [string]$ManagementServer,&lt;BR /&gt; [Parameter(Mandatory = $true)]&lt;BR /&gt; [PSCredential]$Credentials,&lt;BR /&gt; [string]$CertificateHash,&lt;BR /&gt; [int]$ManagementPort = 443,&lt;BR /&gt; [switch]$NoIPv4,&lt;BR /&gt; [switch]$NoIPv6,&lt;BR /&gt; [switch]$Publish,&lt;BR /&gt; [ValidateSet("No", "Warnings", "Errors")]&lt;BR /&gt; [string]$Ignore = "No",&lt;BR /&gt; [switch]$Rename,&lt;BR /&gt; [string]$Color = "red",&lt;BR /&gt; [string]$HostPrefix = "Microsoft",&lt;BR /&gt; [string]$GroupPrefix = "Microsoft_Office365",&lt;BR /&gt; [string]$CommentPrefix = "Microsoft Office365",&lt;BR /&gt; [string]$Tag = "Microsoft_Office365",&lt;BR /&gt; [ValidateSet("All", "Auto", "CertificatePinning", "None", "ValidCertificate")]&lt;BR /&gt; [string]$CertificateValidation = "Auto",&lt;BR /&gt; [ValidateSet("Worldwide", "China", "Germany", "USGovDoD", "USGovGCCHigh")]&lt;BR /&gt; [string]$Instance = "Worldwide"&lt;BR /&gt;)&lt;BR /&gt;# path where client ID will be stored&lt;BR /&gt;$datapath = $Env:TEMP + "\MS_O365_ClientRequestId.txt";&lt;BR /&gt;Write-Verbose "Client ID File: $datapath";&lt;/P&gt;&lt;P&gt;# fetch client ID if data file exists; otherwise create new file&lt;BR /&gt;if (Test-Path $datapath) {&lt;BR /&gt; $content = Get-Content $datapath;&lt;BR /&gt; $clientRequestId = $content;&lt;BR /&gt;}&lt;BR /&gt;else {&lt;BR /&gt; Write-Verbose "Creating new Client ID";&lt;BR /&gt; $clientRequestId = [GUID]::NewGuid().Guid;&lt;BR /&gt; $clientRequestId | Out-File $datapath;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Write-Verbose "Client ID: $clientRequestId";&lt;/P&gt;&lt;P&gt;# Download Microsoft Cloud IP Ranges and Names into Object&lt;BR /&gt;&lt;SPAN&gt;$Version = Invoke-RestMethod &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://endpoints.office.com/version/$($Instance)?ClientRequestId=$clientRequestId;" rel="nofollow"&gt;https://endpoints.office.com/version/$($Instance)?ClientRequestId=$clientRequestId;&lt;/A&gt;&lt;BR /&gt;Write-Verbose "Version: $($Version.latest)";&lt;BR /&gt;&lt;SPAN&gt;$O365IPAddresses = Invoke-RestMethod &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://endpoints.office.com/endpoints/$($Instance)?ClientRequestId=$clientRequestId;" rel="nofollow"&gt;https://endpoints.office.com/endpoints/$($Instance)?ClientRequestId=$clientRequestId;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;# Set variables&lt;BR /&gt;$Updated = ([datetime]::parseexact($Version.latest.Substring(0, 8),"yyyyMMdd",[System.Globalization.CultureInfo]::InvariantCulture)).ToShortDateString();&lt;BR /&gt;$Comments = "$CommentPrefix added $Updated";&lt;BR /&gt;$GroupComments = "$CommentPrefix updated $Updated";&lt;BR /&gt;$Errors = 0;&lt;/P&gt;&lt;P&gt;# Login to Check Point API to get Session ID&lt;BR /&gt;Write-Verbose " *** Log in to Check Point Smart Center API *** ";&lt;BR /&gt;$Session = Open-CheckPointSession -SessionName $CommentPrefix -SessionComments "$CommentPrefix Group Sync" -ManagementServer $ManagementServer -ManagementPort $ManagementPort -Credentials $Credentials -CertificateValidation $CertificateValidation -CertificateHash $CertificateHash -PassThru;&lt;BR /&gt;if (-not $Session) {&lt;BR /&gt; # Failed login&lt;BR /&gt; exit;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;$ServiceAreas = $O365IPAddresses | Select-Object -ExpandProperty serviceArea | Sort-Object -Unique&lt;/P&gt;&lt;P&gt;ForEach ($ServiceArea in $ServiceAreas) {&lt;BR /&gt; $GroupName = $GroupPrefix + "_" + $ServiceArea;&lt;BR /&gt; Write-Verbose "Processing $GroupName";&lt;/P&gt;&lt;P&gt;$ServiceAreaIPs = $O365IPAddresses | Where-Object {$_.serviceArea -eq $ServiceArea -and $_.ips} | Select-Object -ExpandProperty ips;&lt;BR /&gt; if ($NoIPv4.IsPresent) {&lt;BR /&gt; $ServiceAreaIPs = $ServiceAreaIPs | Where-Object { $_ -notmatch "\." }&lt;BR /&gt; }&lt;BR /&gt; if ($NoIPv6.IsPresent) {&lt;BR /&gt; $ServiceAreaIPs = $ServiceAreaIPs | Where-Object { $_ -notmatch ":" }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;$ServiceAreaIPs |&lt;BR /&gt; Invoke-CheckPointGroupSync -Session $Session -GroupName $GroupName -Prefix "${HostPrefix}_" -Rename:$Rename.IsPresent -Ignore $Ignore -Color $Color -Comments $Comments -Tags $Tag -CreateGroup |&lt;BR /&gt; Tee-Object -Variable output;&lt;BR /&gt; if (($output | Where-Object {$_.Actions -ne 0 -and -not $_.Error} | Measure-Object).Count -ne 0) {&lt;BR /&gt; # Updates made&lt;BR /&gt; Write-Verbose "Updating $GroupName group's comment";&lt;BR /&gt; $Group = Set-CheckPointGroup -Session $Session -Name $GroupName -Comments "$GroupComments" -Verbose:$false -PassThru;&lt;BR /&gt; }&lt;BR /&gt; $Errors = $Errors + ($output | Where-Object {$_.Error} | Measure-Object).Count;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;$Stats = Get-CheckPointSession -Session $Session -UID $Session.UID&lt;BR /&gt;Write-Verbose "Total Errors: $Errors";&lt;BR /&gt;if ($Stats.Changes -eq 0) {&lt;BR /&gt; Write-Host "No changes made. Closing session.";&lt;BR /&gt; Reset-CheckPointSession -Session $Session -Verbose:$false;&lt;BR /&gt; Close-CheckPointSession -Session $Session -Verbose:$false;&lt;BR /&gt;} elseif ($Publish.IsPresent -and $Errors -eq 0) {&lt;BR /&gt; # Publish Changes&lt;BR /&gt; Write-Host "Publishing $($Stats.Changes) changes.";&lt;BR /&gt; Publish-CheckPointSession -Session $Session -Verbose:$false;&lt;BR /&gt; Close-CheckPointSession -Session $Session -Verbose:$false;&lt;BR /&gt;} else {&lt;BR /&gt; # Logout from Check Point API&lt;BR /&gt; Write-Host "View $($Stats.Changes) changes in SmartConsole to publish.";&lt;BR /&gt; Close-CheckPointSession -Session $Session -ContinueSessionInSmartconsole -Verbose:$false;&lt;BR /&gt;}&lt;BR /&gt;# DONE!&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the Error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Open-CheckPointSession : Server Error: Forbidden&lt;BR /&gt;In C:\Users\PaGuenther\Downloads\psCheckPoint-Examples-GroupSync\Office365_Group_Sync.ps1:125 Zeichen:12&lt;BR /&gt;+ $Session = Open-CheckPointSession -SessionName $CommentPrefix -Sessio ...&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt; + CategoryInfo : Verbindungsfehler: (psCheckPoint.Se...eckPointSession:OpenCheckPointSession) [Open-CheckPointSession], GenericException&lt;BR /&gt; + FullyQualifiedErrorId : Server Error: Forbidden,psCheckPoint.Session.OpenCheckPointSession&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks for your Help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 11:43:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27061#M1560</guid>
      <dc:creator>Pascal_Guenther</dc:creator>
      <dc:date>2018-09-14T11:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Script Server Error forbidden</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27062#M1561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since this was &lt;A href="https://community.checkpoint.com/migrated-users/47094"&gt;Tim Koopman&lt;/A&gt;‌'s script let's tag him.&lt;/P&gt;&lt;P&gt;Also might provide how you invoked this script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 20:20:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27062#M1561</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2018-09-14T20:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Script Server Error forbidden</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27063#M1562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also, did you enable the API server?&lt;/P&gt;&lt;P&gt;It's not enabled by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.checkpoint.com/legacyfs/online/checkpoint/70321_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Sep 2018 23:12:36 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27063#M1562</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2018-09-14T23:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Script Server Error forbidden</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27064#M1563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So if this is the first time using any API access I would first do as&amp;nbsp;&lt;A href="https://community.checkpoint.com/migrated-users/2075"&gt;Dameon Welch Abernathy&lt;/A&gt; suggests and confirm the API is enabled. Forbidden is the expected error for the server to respond with if the API is enabled but not for your IP Address, or the API is disabled but the server is still listening on that port for other services.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So please confirm the api is started and your IP is allowed, by setting "Accept API calls from" to either "All IP addresses that can be used for GUI clients" or "All IP Addresses". The first is more secure, just make sure your IP is one of the allowed GUI client IPs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let us know if this doesn't help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 20:34:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27064#M1563</guid>
      <dc:creator>Tim_Koopman</dc:creator>
      <dc:date>2018-09-17T20:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Script Server Error forbidden</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27065#M1564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And make sure you are patched. Vanilla R80.10 has a&amp;nbsp; .... feature where it will fail to start if you select to allow only GUI clients to connect.&lt;/P&gt;&lt;P&gt;That was fixed in a jumbo hotfix.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Sep 2018 15:31:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-Script-Server-Error-forbidden/m-p/27065#M1564</guid>
      <dc:creator>Hugo_vd_Kooij</dc:creator>
      <dc:date>2018-09-19T15:31:23Z</dc:date>
    </item>
  </channel>
</rss>

