Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Run Test-ADServiceAccount at remote machine

$
0
0
I am getting error at windows server 2012.

Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not
have the Active Directory Web Services running.
+ CategoryInfo : ResourceUnavailable: (:) [Get-ADServiceAccount], ADServerDownException
+ FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.GetADServiceAccoun
t
+ PSComputerName : AlphaPLA02.englab.caradigm.com

by using below script.

$session = New-PSSession -ComputerName "AlphaPLA02.englab.caradigm.com" -Credential englab\amv3tst

Invoke-Command -Session $session -ScriptBlock `
{ `
$RSATInstalled = Get-WindowsFeature RSAT-AD-PowerShell ; `
if(!$RSATInstalled.Installed)
{
Add-WindowsFeature RSAT-AD-PowerShell ; ` 
} ;
};


Invoke-Command -Session $session -ScriptBlock { Test-ADServiceAccount "gMSACipPlatfor1$" ; }

Viewing all articles
Browse latest Browse all 21975

Trending Articles