WhatsApp: 0623684723

6. Install the Windows Service for the Synctool to be runned automatically

Follow
Note: The synctool and support is available to our Partners. Are you a New Day at Work Partner and interested? Please contact support@newdayatwork.com

Requirements 
Microsoft SQL Server Compact 4.0
https://www.microsoft.com/en-US/download/details.aspx?id=17876
Microsoft Online Services Sign-In Assistant
https://www.microsoft.com/en-us/download/details.aspx?id=28177
Install PowerShell 5.0 
Install module in PowerShell 5.0:
"install-module Azure"
"install-module AzureRm"
An active Azure subscription is required.

Azure AD to Workspace 365 sync tool is not running automatically. Therefore you need create a service that runs the synctool.

Version 2.2.0.1 
Version 2.0 and earlier

 

Version 2.2.0.1:

If you run PowerShell from the synctool folder and enter:

.\NDAW.AzureActiveDirectorySync.Runner.exe help

A list of ways to deploy/install the service will be shown. You can easily deploy the service to your desired configuration. For quick deploy use:

.\NDAW.AzureActiveDirectorySync.Runner.exe install

 This will install the service with the Display name: "Azure Active Directory sync to Workspace 365".

[INFO ] 2018-10-19 15:44:10 Program - AAD to W365 sync tool version is 2.2.0.1
Configuration Result:
[Success] Name AzureActiveDirectorySyncToWorkspaceSyncService
[Success] DisplayName Azure Active Directory sync to Workspace 365
[Success] Description Azure Active Directory sync to Workspace 365
[Success] ServiceName AzureActiveDirectorySyncToWorkspaceSyncService
Topshelf v4.0.0.0, .NET Framework v4.0.30319.42000
Topshelf is a library that simplifies the creation of Windows services using .NET.

Command-Line Reference

  service.exe [verb] [-option:value] [-switch]

    run                 Runs the service from the command line (default)
    help, --help        Displays help

    install             Installs the service

      --autostart       The service should start automatically (default)
      --disabled        The service should be set to disabled
      --manual          The service should be started manually
      --delayed         The service should start automatically (delayed)
      -instance         An instance name if registering the service
                        multiple times
      -username         The username to run the service
      -password         The password for the specified username
      --localsystem     Run the service with the local system account
      --localservice    Run the service with the local service account
      --networkservice  Run the service with the network service permission
      --interactive     The service will prompt the user at installation for
                        the service credentials
      start             Start the service after it has been installed
      --sudo            Prompts for UAC if running on Vista/W7/2008

      -servicename      The name that the service should use when
                        installing
      -description      The service description the service should use when
                        installing
      -displayname      The display name the the service should use when
                        installing

    start               Starts the service if it is not already running

    stop                Stops the service if it is running

    uninstall           Uninstalls the service

      -instance         An instance name if registering the service
                        multiple times
      --sudo            Prompts for UAC if running on Vista/W7/2008

Examples:

    service install
        Installs the service into the service control manager

    service install -username:joe -password:bob --autostart
        Installs the service using the specified username/password and
        configures the service to start automatically at machine startup

    service uninstall
        Uninstalls the service

    service install -instance:001
        Installs the service, appending the instance name to the service name
        so that the service can be installed multiple times. You may need to
        tweak the log4net.config to make this play nicely with the log files.

 

Version 2.0 and earlier:

The script is provided in the root of the synctool folder. Execute the script and ajust the

$serviceName

where needed.

Keep in mind that the service is set by default to "Manual" and you need to change it to "Automatic" if you like to start the server automatically.

 

# If you want to install a service with another name, go to the script path and run it like: & '.\Create Environment Partner.ps1' -serviceName "YOURSERVICENAME" 

Param(
    [Parameter(Mandatory=$False)][string]$serviceName="Workspace365 AAD Sync"
)

if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { 
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit 
}

function CreateWindowsService() {
    
    
    # Set the Executionpath
    $exePath = "$($PSScriptRoot)\AzureADToW365SyncWindowsService.exe"

    # Set the command
    $createService = "sc.exe create `"$serviceName`" binPath=`"$exePath`""
    Invoke-Expression $createService
}

# Call the function to create the Windows Service
CreateWindowsService
Have more questions? Submit a request