$compname = 'AST'
$cripto5 = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\08F19F05793DC7340B8C2621D83E5BE5\InstallProperties'
$cripto4 = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\7AB5E7046046FB044ACD63458B5F481C\InstallProperties'
$kriptoarm = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Digt\Trusted Desktop\License'
Write-Output FIND_CRYPTOARM:(Invoke-Command -ComputerName $compname -ScriptBlock { Test-Path -Path $using:kriptoarm })
Write-Output FIND_CRYPTOPRO4:(Invoke-Command -ComputerName $compname -ScriptBlock { Test-Path -Path $using:cripto4 })
Write-Output FIND_CRYPTOPRO5:(Invoke-Command -ComputerName $compname -ScriptBlock { Test-Path -Path $using:cripto5 })
Write-Output FIND_CRYPTOPRO_KEY
if (Invoke-Command -ComputerName $compname -ScriptBlock { Test-Path -Path $using:cripto5 }) {
Invoke-Command -ComputerName $compname -ScriptBlock { Get-ItemProperty -Path $using:cripto5 -Name ProductID } | Select-Object "ProductID"
}
elseif (Invoke-Command -ComputerName $compname -ScriptBlock { Test-Path -Path $using:cripto4 }) {
Invoke-Command -ComputerName $compname -ScriptBlock { Get-ItemProperty -Path $using:cripto4 -Name ProductID } | Select-Object "ProductID"
}
else {
Write-Output CryptoPro not found
}
Write-Output ([System.Environment]::NewLine)
Write-Output FIND_CRYPTOARM_KEY
if (Invoke-Command -ComputerName $compname -ScriptBlock { Test-Path -Path $using:kriptoarm }) {
Invoke-Command -ComputerName $compname -ScriptBlock { Get-ItemProperty -Path $using:kriptoarm -Name SerialNumber } | Select-Object "SerialNumber"
}
else {
Write-Output CryptoARM not found
}
invoke-command -comp $comp {
# а здесь все красоты
# причём циклом
$source @(
@{ key name= '''; valuename=''},
@{ key name= '''; valuename=''}
)
foreach ($src in $source) {
get-itemproperty -path $src.keyname | select -expandproperty $src.valuename
}
}