So I'm using a powershell script to build a Json file to make sure all the Versions of software are up to date across all domains sites (Several different Data centers that use different domain names. I have a special vpn that has trusts to all the domains so from my laptop I am able to access all the Domains without issue.
I at first thought it was a credential issue so i remove that portion but it seems to be network level and I'm not sure why as I can RDP, browse to the network paths, etc.
Connecting to remote server servera failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find the computer servera. Verify that the computer exists on the network and that the name provided is spelled correctly. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (servera:String) [], PSRemotingTransportException + FullyQualifiedErrorId : NetworkPathNotFound,PSSessionStateBroken
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline = $true,
ValueFromPipelinebyPropertyName = $true)]
[Alias("Servers")]
[string[]]$Name = (Get-Content "c:\versioncheck\servers.txt"),
[string]$Credential = "svcStatusCheck",
[string]$PathToCred = "c:\versioncheck"
)
Begin {
Function Get-Credentials {
Param (
[String]$AuthUser = $env:USERNAME
)
$Key = [byte]29, 36, 18, 74, 72, 75, 85, 52, 73, 44, 0, 21, 98, 76, 99, 28
$CredFile = $AuthUser.Replace("\", "~")
$File = $PathToCred + "\Credentials-$CredFile.crd"
If (-not (Test-Path $File)) {
(Get-Credential $AuthUser).Password | ConvertFrom-SecureString -Key $Key | Set-Content $File
}
$Password = Get-Content $File | ConvertTo-SecureString -Key $Key
$AuthUser = (Split-Path $File -Leaf).Substring(12).Replace("~", "\")
$AuthUser = $AuthUser.Substring(0, $AuthUser.Length - 4)
$Credential = New-Object System.Management.Automation.PsCredential($AuthUser, $Password)
Return $Credential
}
}
Process {
$AllServers = @()
ForEach ($Computer in $Name) {
$AllServers += $Computer
}
}
End {
ForEach ($Computer in $AllServers) {
Write-Host "$(Get-Date): Script begins!"
write-host "Checking $computer"
Invoke-Command -cn $computer -credential $Credential -ScriptBlock { Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object @{Label = "ServerName"; Expression = {$env:computername}}, DisplayName, Publisher, DisplayVersion,InstallDate | Where-object { $_.Publisher -match "Software" } | ConvertTo-Json -depth 100 | Out-File "c:\versioncheck\InstalledApps.json"}
}
}