Skip to content
InvardiaInvardia
Why InvardiaProductsFeaturesPricingCommunity
Docs
All documentation
Product documentationPIM ManagerSecurityInsight
SettingsPIM Manager settingsSecurityInsight settingsEntra Policy Suite settings
ScriptsPIM Manager scriptsSecurityInsight scriptsEntra Policy Suite scriptsInvardia scripts
Error codesPIM Manager error codesSecurityInsight error codes
API and MCPPIM Manager APIPIM Manager MCP toolsSecurityInsight APISecurityInsight MCP tools
SecurityPIM Manager security packSecurityInsight security packEntra Policy Suite security pack
Network and designPIM Manager network guidesPIM Manager command wizardNetwork egressDesign your installationCalculate your cost
SupportSetup scriptsRemote support access
Search the docs
SupportAboutContactBook a demoCustomer portalDesign your installationFree Pro trial

PIM Manager scripts

Install-PimHybridWorker

PIM for Active Directory: install and configure the hybrid worker on the worker machine

Purpose

Installs and configures the PIM for Active Directory hybrid worker on the worker machine itself (an Azure VM or an Azure Arc-enabled on-premises server): the gMSAs, the PIM code for its update ring and the scheduled tasks.

When to run it

On the worker, as SYSTEM or a local administrator -- normally delivered through run-command by Invoke-PimHybridWorkerRunCommand.ps1: -Phase Join (Azure VM, then it reboots), -Phase Configure after the grants (with -PlanOnly first if you like). The daily task runs -Phase Update by itself.

Who may run it

KindRoleScopeWhy
otherLocal Administrator / SYSTEM on the worker (run-command runs it as SYSTEM)the worker machineinstalls PowerShell 7, the gMSAs, user rights, the C:\PIM folder and scheduled tasks

What it changes

WhereActionWhatPermission / roleScopeWhyUndo
the worker machine (-Phase Join, Azure VM)updateoffline domain join from the blob, then a rebootthe Azure VM joins the domain without line of sightunjoin the machine
the worker machine (-Phase Configure)createPowerShell 7 (Microsoft-signed MSI from github.com); the gMSA(s) installed and tested; 'log on as a batch job' for them; C:\PIM (inheritance removed: SYSTEM + Administrators write, the gMSAs read); the PIM code for the ring; the run wrapper; six scheduled tasks (PIM Hybrid Worker, PIM Hybrid AD Sync, PIM Hybrid AD Sync Servers, PIM Hybrid AD Changes, PIM Hybrid Servers with -ServerGmsaName, PIM Hybrid Worker Update)the worker itself; no password, secret or certificate is storeddelete the 'PIM Hybrid *' scheduled tasks and C:\PIM; remove the gMSAs from 'log on as a batch job'
the worker machine (Azure Arc)updatethe gMSA(s) added to the local group 'Hybrid agent extension applications' (never Administrators)the tasks run as the gMSAs and must answer the Arc agent's key-file challenge for the machine identityremove them from that group
the worker machine (Azure VM, -Phase Configure)updatethe machine account password is changed once (nltest /sc_change_pwd)makes the offline-join blob worthlessnone needed
the worker machine (Azure VM: -Phase Configure, Layout, Update and MetadataAccess)createone outbound Windows Firewall rule, 'PIM Hybrid Worker - metadata service access': the instance metadata service (169.254.169.254, TCP 80) answers only SYSTEM (the Azure VM agent and its extensions), the worker's gMSAs and the gMSA of each product registered on the machine (C:\ProgramData\HybridWorkerHost\guests); every other account is blocked. Replaced on each run; the accounts are printed with their SIDs, and a warning names any account that cannot be resolved. Not on an Azure Arc serveronly the accounts that need the machine's managed identities can ask for their tokens-Phase Remove, or delete the rule
the worker machine (-Phase Remove)removethe six scheduled tasks, the gMSA(s) from 'Hybrid agent extension applications' (Arc) and from 'log on as a batch job', the metadata-service firewall rule, C:\PIM\app and C:\PIM\bin (logs kept); the machine, its agent, PowerShell 7 and the domain membership stayretiring the worker (Remove-PimHybridWorker.ps1)-Phase Configure

What it only reads

  • the domain-join state, the host type (the himds service / the Arc variables), the installation's licence and install key from the PIM database with the machine identity (with -UpdateSource Blob: channel.json for the ring instead), the installed version, the registered guests (C:\ProgramData\HybridWorkerHost\guests\*.json) and the account names they and worker.json give

Parameters

ParameterRequiredDefaultWhat it does
-PhaseyesJoin (Azure VM), Configure, Update, Layout, Remove (unregister the worker's tasks and rights on this machine; Remove-PimHybridWorker.ps1 -Target Arc runs it), Guests (read only: lists the other products registered on this machine; Remove-PimHybridWorker.ps1 runs it before it removes a VM), or MetadataAccess (Azure VM: re-applies only the metadata-service rule; a product that registers on or leaves this machine runs C:\PIM\bin\Install-PimHybridWorker.ps1 -Phase MetadataAccess as SYSTEM right after).
-OdjBlobno-Phase Join: the offline domain-join blob (gz:...).
-GmsaNameno-Phase Configure (required): DOMAIN\gMSA-PIM-L1-T0.
-ServerGmsaNamenoDOMAIN\gMSA-PIM-L2-T1 for server onboarding in its own task.
-SqlServerno-Phase Configure (required): the PIM SQL server FQDN.
-SqlDatabasenoPimPlatformThe PIM database.
-TenantIdno-Phase Configure (required): the tenant.
-SourceContainerUrlno-Phase Configure with -UpdateSource Blob (required there): https://<store>.blob.core.windows.net/<container> with the PIM code and channel.json.
-UpdateSourcenoInvardia-Phase Configure: where the worker's code comes from, for the first install and every daily update. Invardia (the default): the signed release of the worker's own release ring from the Invardia update service -- its signature, ring and the archive's SHA-256 and size are checked before anything is unpacked, and nothing is installed when a check fails. Blob: the source container above, for an installation that does not use Invardia.
-RingnoThe update ring the worker follows (the environment's).
-VersionnoPin a version instead of a ring.
-AdServernoA specific domain controller for the worker's AD calls.
-RootnoC:\PIMThe worker's folder.
-IntervalMinutesno5The safety-net task's interval.
-NoRebootnofalse-Phase Join: do not reboot (reboot yourself).
-PlanOnlynofalseEvery run plans and logs, nothing is written to AD until Configure is re-run without it.
-HostTypenoAutoAuto, AzureVm (IMDS identity) or Arc (the Azure Arc agent's identity).

Preview with -WhatIf

Prints what the phase would do on this host (join, gMSAs, Arc group, the code, the six tasks and the metadata-service rule with the accounts it lets through) and changes nothing.

Undo

Delete the 'PIM Hybrid *' scheduled tasks, the firewall rule 'PIM Hybrid Worker - metadata service access' and C:\PIM; on Arc remove the gMSAs from 'Hybrid agent extension applications'.

Network

It connects to: the Invardia update service (invardia.com) for the signed release and the PIM SQL database, with the machine identity (with -UpdateSource Blob: the source store, <store>.blob.core.windows.net, instead); api.github.com / github.com / objects.githubusercontent.com once (PowerShell 7); the identity endpoint on the machine (IMDS on an Azure VM, the Arc agent on localhost:40342). Modules: only the owner-approved in-box Windows ScheduledTasks, CimCmdlets and NetSecurity (Windows Firewall) (framework 12.17); no ActiveDirectory module

Download and run

Run these lines in PowerShell: the first downloads the script into the current folder, the second runs it.

Invoke-WebRequest https://invardia.com/support/pim/Install-PimHybridWorker.ps1 -OutFile Install-PimHybridWorker.ps1
.\Install-PimHybridWorker.ps1 -Phase <Phase>

To check the download first, compare its SHA-256 with the published one:

SHA-256 056ad3124e6c82876424222679fa49fc05b0b1c34a2c59b176e69bc5e2292a6c

Checksums: SHA256SUMS.txt · Version 3.0.70

Before you run it, compare the file's SHA-256 with its line in SHA256SUMS.txt.

Every parameter: Get-Help .\Install-PimHybridWorker.ps1 -Full · Source: Install-PimHybridWorker.ps1

Every script, identity and permission for your security review: PIM Manager

InvardiaInvardia

See the risk. Control the access.

Products

PIM ManagerSecurityInsightEntra Policy SuiteAll featuresPricingFree 60-day Pro trialBook a demoWhy Invardia

Docs

DocumentationSearch the docsPIM Manager settingsSecurityInsight settingsPIM network guidesCommand wizardNetwork egressPIM Manager design configuratorSecurityInsight design configuratorDesign your installationCalculate your cost

Company

AboutContactCustomer portalSupportHow support worksHow updates reach youSupport in numbersSetup scriptsRemote support accessContact: info@invardia.com

Legal

Terms of saleLicence termsData processingPrivacyCookiesCompany information
© 2026 Invardia – a brand of 2LINKIT, founded and owned by Morten Knudsen · Strandvejen 21A, 6000 Kolding, Denmark · VAT DK39208032 · Contact: info@invardia.com