-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-RaaSInformation.ps1
More file actions
26 lines (22 loc) · 854 Bytes
/
Copy pathGet-RaaSInformation.ps1
File metadata and controls
26 lines (22 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$Computername = "localhost"
$rObject = New-Object psobject -Property @{
ComputerName = $null
AOSInstanceFound = $false
AOSInstance = $null
}
Write-Verbose("Obtaining Win32_ComputerSystem object for Computername")
$computer = Get-WmiObject Win32_ComputerSystem -ComputerName $Computername
$rObject.ComputerName = $computer.Name
Write-Verbose("Obtaining AOS Service Instances won't throw error due to wildecard search")
$aos = Get-Service | ? { $_.Status -eq "Running" -AND $_.DisplayName -match "Microsoft Dynamics AX Object" }
Write-Verbose("Could potentially find no AOS nothing")
try {
$rObject.AOSInstance = $aos[0].Name
$rObject.AOSInstanceFound = $true
}
catch {
Write-Error("AOS service instances not found")
$rObject.AOSInstance = "01"
}
Write-Verbose("Returning custom object")
$rObject