Skip to content

Instantly share code, notes, and snippets.

@juneb
Last active December 19, 2016 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juneb/496639bddf5dab1911ab to your computer and use it in GitHub Desktop.
Save juneb/496639bddf5dab1911ab to your computer and use it in GitHub Desktop.
Opens the SAPIEN forum that you specify in your default internet browser window.
<#
.SYNOPSIS
Gets or opens a SAPIEN forum page.
.DESCRIPTION
The Start-SAPIENForum.ps1 script opens the SAPIEN forum that you specify in
your default internet browser window. It can also search the forums (all of
them) for the search term that you specify.
To open a particular forum, use the Name parameter. If the value of the Name
parameter matches one forum name, the script opens the forum. Otherwise, it returns
objects that represent the forums.
To search all forums, use the Search parameter.
To get a list of SAPIEN forums, omit the Name or use the ListOnly parameter.
.PARAMETER Name
Enter the full or partial name of a forum. This parameter is optional. By default,
Start-SAPIENForum.ps1 returns an object that represents each forum.
.PARAMETER ListOnly
Instead of opening a forum, ListOnly returns a custom object for with the Name, URL, and Description of each forum.
.PARAMETER Search
Searches all forums for the specified term and opens the page with the results. Enter one or more search terms in a string.
.EXAMPLE
.\Start-SAPIENForum.ps1
This command returns an object representing each SAPIEN forum.
.EXAMPLE
.\Start-SAPIENForum.ps1 -ListOnly
This command returns an object representing each SAPIEN forum.
.EXAMPLE
.\Start-SAPIENForum.ps1 -Name 'PowerShell Studio'
This command opens the PowerShell Studio forum.
.EXAMPLE
.\Start-SAPIENForum.ps1 -Name 'PowerShell Studio' -ListOnly
This command returns an object that represents the PowerShell Studio forum.
.EXAMPLE
.\Start-SAPIENForum.ps1 -Name GUI
This command opens the PowerShell GUI forum.
.EXAMPLE
.\Start-SAPIENForum.ps1 -Search 'How to Install PowerShell V 5.0 '
This command searches all SAPIEN support forums for search query 'How to Install Powersehll V 5.0' and opens the results in your default internet browser.
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.111
Created on: 2/25/2016 1:16 PM
Updated on: 3/22/2015
Created by: June Blender
Organization: SAPIEN Technologies, Inc
Filename: Start-SAPIENForums.ps1
Gist link: https://gist.github.com/juneb/496639bddf5dab1911ab
Thanks to Prasoon V. Karunan (@prasoonkarunan) for contributing the Search parameter.
===========================================================================#>
[CmdletBinding(DefaultParameterSetName = 'NameSet')]
param
(
[Parameter(ParameterSetName = 'NameSet')]
[String]
$Name,
[Parameter(ParameterSetName = 'NameSet')]
[Switch]
$ListOnly,
[Parameter(ParameterSetName = 'SearchSet')]
[ValidateNotNullOrEmpty()]
[String]
$Search
)
$script:Forums
$ForumUrl = 'http://www.sapien.com/forums/viewforum.php?f='
$ForumTable = @'
Trial Software Questions, 8, Use this forum to ask questions before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Scripting Answers, 6, A collection of forums for questions about scripting in PowerShell and other languages.
Windows PowerShell, 18, Ask your Windows PowerShell-related questions, including questions on cmdlet development!
PowerShell GUIs, 21,Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
PowerShell Studio, 12, Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
PowerShell HelpWriter, 28, Product Support for PowerShell HelpWriter
PrimalScript, 11, Support for all customers who have purchased a PrimalScript product license. This forum does not offer a response time guarantee.
PrimalSQL, 14, Product support for PrimalSQL users
PrimalXML, 15, Product support for PrimalXML users
VersionRecall, 22, Support for all customers who have purchased a VersionRecall product license. This forum does not offer a response time guarantee.
WMI Explorer, 24, Product support for WMI Explorer users
Productivity Pack Support, 10, Product Support for the SAPIEN Productivity Pack
iPowerShell Pro, 17, Support forums for users of iPowerShell Pro
ChangeVue, 16, Product support for ChangeVue users
Customer Service, 7, Use this forum to ask about non-product related topics (login issues, product registrations, web site questions, etc.) No technical support questions, please.
VBScript, 19, Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Other Scripting Languages, 20, Other Scripting Languages
Feedback, 23, Anything you want to tell us? Praise? Criticism? Post it here. Please keep it professional and constructive.
Wish List and Feature Requests, 9, Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
'@
function Load-Forums
{
try
{
if ($script:Forums = ConvertFrom-Csv -InputObject $ForumTable -Header Name, URL, Description -ErrorAction Stop)
{
$script:Forums | foreach { $_.URL = "$ForumUrl$($_.URL)" }
return $True
}
}
Catch
{
throw 'Cannot load forum table. Contact @juneb_get_help.'
}
}
if (Load-Forums)
{
if ($Search)
{
$searchUrl = "http://www.sapien.com/forums/search.php?keywords=$Search"
Start-Process $searchUrl
break;
}
if (!$Name)
{
return $script:Forums
}
else
{
if ($match = $script:Forums | where Name -like "*$Name*")
{
if ($ListOnly -or $match.count -gt 1)
{
$match
}
else
{
Start-Process $Match.URL
}
}
else
{
Write-Warning "No forum name includes: $Name."
$script:Forums
}
}
}
@juneb
Copy link
Author

juneb commented Mar 22, 2016

Updated 3/22/2016. Thanks to Prasoon V. Karunan (@prasoonkarunan) for the Search parameter idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment