Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update List-HostnamesInContract.ps1 #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions examples/List-HostnamesInContract.ps1
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
#************************************************************************
#
# Name: List-HostnamesInContract
# Author: S Macleod
# Purpose: Uses PAPI to get all properties in contract and list hostnames
# Date: 04/02/2019
# Version: 1 - Initial
#
#************************************************************************

Param(
[Parameter(Mandatory=$false)] [string] $EdgeRCFile = "~\.edgerc",
[Parameter(Mandatory=$false)] [string] $Section = 'default',
[Parameter(Mandatory=$false)] [string] $AccountSwitchKey
)

if(!(Get-Module AkamaiPowershell))
{
Write-Host -ForegroundColor Yellow "Please import the Akamai Powershell module before running this script"
return
}

$Results = @()
$Properties = Get-AllProperties -Section $Section -AccountSwitchKey $AccountSwitchKey
Write-Host -ForegroundColor yellow "Found $($Properties.Count) properties"

foreach($Property in $Properties)
{
$PropHostnames = List-PropertyHostnames -GroupID $Property.groupId -ContractId $Property.contractId -PropertyId $Property.propertyId -PropertyVersion $Property.LatestVersion -Section $Section -AccountSwitchKey $AccountSwitchKey
$PropHostnames | foreach {
#$Results += @{ "Property" = $Property.propertyName; "Hostname" = $_.cnameFrom}
$Result = New-Object -TypeName PSObject
$Result | Add-Member -MemberType NoteProperty -Name "Property" -Value $Property.propertyName
$Result | Add-Member -MemberType NoteProperty -Name "Hostname" -Value $_.cnameFrom
$Results += $Result
}
}

Write-Host -ForegroundColor Yellow "Found $($results.Count) hosts"
return $Results
#************************************************************************
#
# Name: List-HostnamesInContract
# Author: S Macleod
# Purpose: Uses PAPI to get all properties in contract and list hostnames
# Date: 04/02/2019
# Version: 1 - Initial
#
#************************************************************************
Param(
[Parameter(Mandatory=$false)] [string] $EdgeRCFile = "~\.edgerc",
[Parameter(Mandatory=$false)] [string] $Section = 'default',
[Parameter(Mandatory=$false)] [string] $AccountSwitchKey
)
if(!(Get-Module AkamaiPowershell))
{
Write-Host -ForegroundColor Yellow "Please import the Akamai Powershell module before running this script"
return
}
$Results = @()
$Properties = Get-AllProperties -Section $Section -AccountSwitchKey $AccountSwitchKey
Write-Host -ForegroundColor yellow "Found $($Properties.Count) properties"
foreach($Property in $Properties)
{
$PropHostnames = @(List-PropertyHostnames -GroupID $Property.groupId -ContractId $Property.contractId -PropertyId $Property.propertyId -PropertyVersion $Property.LatestVersion -Section $Section -AccountSwitchKey $AccountSwitchKey)
$PropHostnames | foreach {
#$Results += @{ "Property" = $Property.propertyName; "Hostname" = $_.cnameFrom}
$Result = New-Object -TypeName PSObject
$Result | Add-Member -MemberType NoteProperty -Name "Property" -Value $Property.propertyName
$Result | Add-Member -MemberType NoteProperty -Name "Hostname" -Value $_.cnameFrom
$Results += $Result
}
}
Write-Host -ForegroundColor Yellow "Found $($results.Count) hosts"
return $Results

# SIG # Begin signature block
# MIIp0wYJKoZIhvcNAQcCoIIpxDCCKcACAQExDzANBglghkgBZQMEAgEFADB5Bgor
Expand Down