I have a One Way Trust between a USER (Trusted) Forest (Domain_A) and a RESOURCE (Trusting) Forest (Domain_B)
From ADUC on Domain_B, I can add my various RESOURCE (Local) groups to USER (Global) groups ,from Domain_A but I cannot replicate that functionality in Powershell (executed from Domain_B)
To Test what's going wrong, I have checked whether the following lines work (first is to prove my syntax is correct. The Working Line,, successfully queries the local Domain and inputs the information into the variable $g
However, the failing lines, times out and when I check the Firewall traffic, nothing is being sent down the Firewall for Domain_B. How can I force the script to actually recognise that Domain_A queries need to go though the Firewall ?
When I perform an NLTEST command (nltest.exe /dclist:Domain_A), i get a correct response for the two DC's in that TRUSTED domain and when I ping those DC's the DNS forwarders know to route the traffic through the Firewall but the PS script doesn't seem to know what to do ?
Obviously once I get over this hurdle, I have can add this line back into a script for managing all my resource groups,' access
$g = Get-ADGroup -Server "domain_B" <group_that_exists_In_Domain_B>
$AdminCredentials = Get-Credential "Domain_A\<admin-name>"
$g = Get-ADGroup -Server "domain_A"" group_that_exists_In_Domain_A> -Credential $AdminCredentials
Get-ADGroup : 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.
You cannot use local variables in a remote session without properly scoping them. See the docs on the topic.
A variable, alias, or function name can include any one of the following optional scope modifiers:
• global: - Specifies that the name exists in the Global scope.• local: - Specifies that the name exists in the Local scope. The current scope is always the Local scope.• private: - Specifies that the name is Private and only visible to the current scope.• script: - Specifies that the name exists in the Script scope. Script scope is the nearest ancestor script file's scope or Global if there is no nearest ancestor script file.• using: - Used to access variables defined in another scope while running scripts via cmdlets like Start-Job and Invoke-Command.• workflow: - Specifies that the name exists within a workflow. Note: Workflows are not supported in PowerShell Core.• <variable-namespace> - A modifier created by a PowerShell PSDrive provider. For example:
The Using: scope modifier
Using is a special scope modifier that identifies a local variable in a remote command. Without a modifier, PowerShell expects variables in remote commands to be defined in the remote session.
The Using scope modifier is introduced in PowerShell 3.0.
For more information, see about_Remote_Variables.https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_remote_variables?view=powershell-6
Powered by IDERA