Add ALD Transition Console preview and Astra lab build workflow
This commit is contained in:
1 parent
f330a3c00a
commit
e5c6a2fc0e
199 files changed
+9866
No files matched your search
@@ -0,0 +1,44 @@
|
||||
# Fixed read-only AD DC inventory; no credentials. See manifest and adapter contract.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
||||
Import-Module ActiveDirectory -ErrorAction Stop
|
||||
$node = Get-CimInstance Win32_ComputerSystem
|
||||
if ($node.DomainRole -lt 4) { throw 'Select the source AD domain controller.' }
|
||||
$domain = Get-ADDomain -Server $node.Name
|
||||
if ($domain.DNSRoot -ine 'corp.local') { throw 'Source domain must be corp.local.' }
|
||||
$forest = Get-ADForest -Server $node.Name
|
||||
$now = [DateTime]::UtcNow.ToString('o')
|
||||
$source = $domain.ObjectGUID.ToString()
|
||||
$objects = New-Object 'System.Collections.Generic.List[object]'
|
||||
$truncated = $false
|
||||
$allowed = @('objectSid','sAMAccountName','userPrincipalName','displayName','memberOf','groupType','userAccountControl','servicePrincipalName','gPLink','gPOptions')
|
||||
Get-ADObject -Server $node.Name -LDAPFilter '(|(objectClass=user)(objectClass=group)(objectClass=organizationalUnit)(objectClass=groupPolicyContainer))' -SearchBase $domain.DistinguishedName -Properties $allowed -ResultSetSize 50001 | ForEach-Object {
|
||||
if ($objects.Count -ge 50000) { $truncated = $true; return }
|
||||
$item = $_
|
||||
$sid = ''
|
||||
if ($null -ne $item.objectSid) { $sid = [string]$item.objectSid }
|
||||
$kind = [string]$item.ObjectClass
|
||||
if ($kind -eq 'groupPolicyContainer') { $kind = 'gpo' }
|
||||
if (@('user','group','organizationalUnit','computer','gpo') -notcontains $kind) { $kind = 'other' }
|
||||
$attributes = @{}
|
||||
foreach ($name in $allowed) {
|
||||
if ($name -ne 'objectSid' -and $name -ne 'memberOf' -and $null -ne $item.$name) {
|
||||
$attributes[$name] = @($item.$name | ForEach-Object { [string]$_ })
|
||||
}
|
||||
}
|
||||
$objects.Add(@{
|
||||
source_system_id = $source; object_guid = $item.ObjectGUID.ToString(); sid = $sid
|
||||
dn = $item.DistinguishedName; object_type = $kind; attributes = $attributes
|
||||
memberships = @($item.memberOf | ForEach-Object { [string]$_ }); observed_at = $now
|
||||
})
|
||||
}
|
||||
@{
|
||||
schema_version = 1; source_system_id = $source; source_domain = $domain.DNSRoot; synthetic = $false
|
||||
scope = @{
|
||||
description = ('Directory naming context: ' + $domain.DistinguishedName + '; forest mode: ' + $forest.ForestMode + '; domain mode: ' + $domain.DomainMode)
|
||||
complete = $false
|
||||
denied_or_unreachable = @('DNS/DHCP zone and lease content not collected','File data and ACLs not collected','GPO reports, SYSVOL and effective outcomes not collected','Service/application bindings and AD CS not collected','Password/profile continuity not evaluated',$(if ($truncated) { 'Object limit reached: partial inventory' } else { 'Directory ACL visibility must be verified by source owner' }))
|
||||
categories = @('users','groups','ou','computers','gpo_links')
|
||||
}
|
||||
hosts = @(); objects = @($objects.ToArray())
|
||||
} | ConvertTo-Json -Depth 16 -Compress
|
||||
@@ -0,0 +1,34 @@
|
||||
# ALD Transition Console / fixed read-only task / Windows PowerShell 5.1
|
||||
# No PowerShell SSH subsystem, profile, background job or persistent task.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding($false)
|
||||
$errors = New-Object 'System.Collections.Generic.List[string]'
|
||||
$os = Get-CimInstance -ClassName Win32_OperatingSystem
|
||||
$computer = Get-CimInstance -ClassName Win32_ComputerSystem
|
||||
$features = @()
|
||||
try {
|
||||
$features = @(Get-WindowsCapability -Online | Where-Object { $_.Name -like 'OpenSSH*' } | ForEach-Object {
|
||||
@{ name = $_.Name; state = [string]$_.State }
|
||||
})
|
||||
} catch { $errors.Add('Optional-feature inventory unavailable: elevation or servicing prerequisite required.') }
|
||||
$ssh = Get-Service -Name sshd -ErrorAction SilentlyContinue
|
||||
$result = @{
|
||||
schema_version = 1
|
||||
task = 'windows.discovery'
|
||||
observed_at = [DateTime]::UtcNow.ToString('o')
|
||||
os_edition = $os.Caption
|
||||
os_release = $os.Version
|
||||
os_build = $os.BuildNumber
|
||||
architecture = $os.OSArchitecture
|
||||
domain_role = [int]$computer.DomainRole
|
||||
part_of_domain = [bool]$computer.PartOfDomain
|
||||
domain = $computer.Domain
|
||||
name = $computer.Name
|
||||
powershell_version = $PSVersionTable.PSVersion.ToString()
|
||||
optional_features = $features
|
||||
feature_inventory_complete = ($errors.Count -eq 0)
|
||||
sshd_state = $(if ($null -eq $ssh) { 'NOT_INSTALLED' } else { [string]$ssh.Status })
|
||||
errors = @($errors)
|
||||
synthetic = $false
|
||||
}
|
||||
$result | ConvertTo-Json -Depth 8 -Compress
|
||||
Reference in new issue
Block a user