Skip to content

Commit 48a31ad

Browse files
committed
Add private folder & Test-ServiceNowURL private function
1 parent c54b51c commit 48a31ad

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Function Test-ServiceNowURL {
2+
<#
3+
.SYNOPSIS
4+
For use in testing ServiceNow Urls.
5+
6+
.DESCRIPTION
7+
For use in testing ServiceNow Urls. The test is a simple regex match in an attempt to validate that users use a 'tenant.domain.com' pattern.
8+
9+
.EXAMPLE
10+
Test-ServiceNowURL -Url tenant.domain.com
11+
12+
This example can have text
13+
14+
.OUTPUTS
15+
System.Boolean
16+
17+
#>
18+
19+
[OutputType([System.Boolean])]
20+
[CmdletBinding()]
21+
param (
22+
# Pipeline variable
23+
[Parameter(Mandatory = $true)]
24+
[ValidateNotNullOrEmpty()]
25+
[string]$Url
26+
)
27+
28+
begin {}
29+
process {
30+
Write-Verbose "Testing url: $Url"
31+
if ($Url -match '^\w+\..*\.\w+') {
32+
$true
33+
}
34+
else {
35+
Throw "The expected URL format is tenant.domain.com"
36+
}
37+
}
38+
end {}
39+
}

0 commit comments

Comments
 (0)