Executing PowerShell remotely for Azure AD connect from laptop without ADSync and no RDP to the server?

People,

I need to execute the Office 365 Azure AD Synch from my computer to the server running the Azure AD Connect v1.11 (PRDADC01-VM) I have made some changes to the AD Attributes.

[CmdletBinding()]
Param(
    [Parameter(position = 0, mandatory = $true)]
    [ValidateSet('Delta', 'Full')]
    [String]$Type,
    [string]$ComputerName = 'PRDADC01-VM'
)
Invoke-Command -ComputerName $ComputerName -ArgumentList $type -ScriptBlock {
    Param($Type)
    If ($Type -eq 'Full') {$Type = 'Initial'}
    Import-Module adsync
    Start-ADSyncSyncCycle -PolicyType $Type
}

Open in new window


Can someone here please assist me with the correct PowerShell to execute from my laptop which does not require me to install the ADSync ?

Because when I execute the above script from my VS Code, it is not doing anything and no confirmation of success either?

Thanks in advance.
LVL 11
Senior IT System EngineerSenior Systems EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MaheshArchitectCommented:
enable powershell remoting on AD connect server
add ad sync server as trusted host on your management machine
then use invoke command to run sync commands on remote server
follow steps in below article and you should be able to...

https://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/
Jian An LimSolutions ArchitectCommented:
This is the powershell to trigger the adsync (after you follow the above link)

http://www.expta.com/2017/01/how-to-trigger-aad-connect-sync-from.html

you still need the local admin rights to trigger that.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Senior IT System EngineerSenior Systems EngineerAuthor Commented:
Thanks !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.