Skip to content

Commit

Permalink
added missing helper function; fixed bug in Get-ScsmPxRelatedObject t…
Browse files Browse the repository at this point in the history
…hat prevented it from retrieving related items from a collection of objects
  • Loading branch information
KirkMunro committed Jan 20, 2016
1 parent 952b32a commit d24d34f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ScsmPx.psd1
Expand Up @@ -24,7 +24,7 @@ limitations under the License.
@{
ModuleToProcess = 'ScsmPx.psm1'

ModuleVersion = '1.0.15.58'
ModuleVersion = '1.0.16.59'

GUID = '2fb132d0-0eea-434f-9619-e8c134e12c57'

Expand Down Expand Up @@ -387,6 +387,7 @@ limitations under the License.
'helpers\Add-ClassHierarchyToTypeNameList.ps1'
'helpers\ConvertTo-TypeProjectionCriteriaXml.ps1'
'helpers\Join-CriteriaXml.ps1'
'helpers\Test-LocalComputer.ps1'
'scripts\Initialize-NativeScsmEnvironment.ps1'
'xslt\emoCriteriaToProjectionCriteria.xslt'
)
Expand Down
2 changes: 1 addition & 1 deletion functions/Get-ScsmPxRelatedObject.ps1
Expand Up @@ -120,7 +120,7 @@ function Get-ScsmPxRelatedObject {
}
process {
try {
foreach ($item in Get-Variable -Name $searchParameter -ValueOnly) {
foreach ($item in (Get-Variable -Name $searchParameter -ValueOnly)) {
if ($PSCmdlet.MyInvocation.BoundParameters.ContainsKey('RelationshipClassName') -or
$PSCmdlet.MyInvocation.BoundParameters.ContainsKey('RelationshipClass')) {
#region Get the related items when we have a relationship class name to work with.
Expand Down
61 changes: 61 additions & 0 deletions helpers/Test-LocalComputer.ps1
@@ -0,0 +1,61 @@
<#####################################################################
These files contain scripts used to assist in troubleshooting support
issues related to the Provance 2012 IT Asset Management Pack and the
Provance 2012 Data Management Pack. Do not edit or change the contents
of these files directly.
Copyright (c) 2016 Provance Technologies. All rights reserved.
Proprietary and Confidential.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE. IF THIS CODE AND INFORMATION IS MODIFIED, THE ENTIRE RISK OF
USE OR RESULTS IN CONNECTION WITH THE USE OF THIS CODE AND INFORMATION
REMAINS WITH THE USER.
######################################################################>

function Test-LocalComputer {
[CmdletBinding()]
param(
[Parameter(Position=0, Mandatory)]
[ValidateNotNullOrEmpty()]
[System.String[]]
$ComputerName
)
try {
#region Look up the host entry in DNS.

$hostEntry = [System.Net.Dns]::GetHostEntry('')

#endregion

#region Create a list of local computer identifiers from well-known identifiers and the host entry details.

$resultIdentifiers = @(
'localhost'
'192.168.0.1'
'127.0.0.1'
'::1'
$env:COMPUTERNAME
$hostEntry.HostName
) + $hostEntry.AddressList.IPAddressToString

#endregion

#region Return true if all of the computer names are in the list of local computer identifiers; false otherwise.

$result = $true
foreach ($item in $ComputerName) {
if ($resultIdentifiers -notcontains $item) {
$result = $false
break
}
}
$result

#endregion
} catch {
$PSCmdlet.ThrowTerminatingError($_)
}
}

0 comments on commit d24d34f

Please sign in to comment.