> For the complete documentation index, see [llms.txt](https://www.osdeploy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.osdeploy.com/guide/cmdlets/get-osdeploymodulepath.md).

# Get-OSDeployModulePath

Return and use the root path of the currently loaded OSDeploy module.

`Get-OSDeployModulePath` returns the absolute path to the root directory of the OSDeploy module loaded in the current PowerShell session. Use the returned path to locate module-relative catalogs, configuration files, templates, and other resources without assuming where PowerShell installed the module.

## Requirements

Install OSDeploy and run the command from PowerShell 7.6 or later. See [Module Setup](/guide/requirements/powershell-modules.md) for installation and import instructions.

Import OSDeploy before using the function in a script that must control which installed module version is loaded:

```powershell
Import-Module -Name OSDeploy -Force
```

{% hint style="warning" %}
The function returns the path of the loaded OSDeploy module, which is not necessarily the newest version installed on the computer. Import the required version explicitly when a script depends on resources from a specific release.
{% endhint %}

## Parameters

`Get-OSDeployModulePath` has no function-specific parameters and does not accept pipeline input. It supports PowerShell common parameters through `CmdletBinding`, but they do not change path resolution.

## Examples

### Return the loaded module path

Return the root directory of the OSDeploy module loaded in the current session:

```powershell
Get-OSDeployModulePath
```

### Build a path to a module resource

Use `Join-Path` to create a platform-safe path to `core\module.json`:

```powershell
$ModulePath = Get-OSDeployModulePath
$ModuleJsonPath = Join-Path -Path $ModulePath -ChildPath 'core\module.json'

$ModuleJsonPath
```

### Read module configuration

Locate and parse the module configuration as structured JSON:

```powershell
$ModuleJsonPath = Join-Path `
	-Path (Get-OSDeployModulePath) `
	-ChildPath 'core\module.json'

$ModuleConfiguration = Get-Content -Path $ModuleJsonPath -Raw |
	ConvertFrom-Json

$ModuleConfiguration
```

### Verify the loaded installation location

Compare the function result with the module metadata reported by `Get-Module`:

```powershell
$ModulePath = Get-OSDeployModulePath
$LoadedModule = Get-Module -Name OSDeploy

[PSCustomObject]@{
	FunctionPath = $ModulePath
	ModuleBase   = $LoadedModule.ModuleBase
	Matches      = $ModulePath -eq $LoadedModule.ModuleBase
}
```

### Select and import a specific installed version

List installed versions, import the required release, and then return its root path:

```powershell
Get-Module -Name OSDeploy -ListAvailable |
	Sort-Object -Property Version -Descending |
	Select-Object -Property Name, Version, ModuleBase

Import-Module -Name OSDeploy -RequiredVersion '26.8.0' -Force
Get-OSDeployModulePath
```

Replace `26.8.0` with a version installed on the computer.

## Path Resolution

The function reads the `ModuleBase` property from the module associated with the running command. It does not search `PSModulePath`, inspect other installed releases, or choose the newest available version.

The returned path therefore follows the module import performed by PowerShell. When multiple OSDeploy versions are installed side by side, use `Import-Module -RequiredVersion` before calling the function to select a specific release.

Use `Join-Path` for child resources instead of concatenating strings. The returned value identifies the module root and does not include a trailing resource path.

## Session Behavior

The function does not search installed releases, modify files, install modules, or change the current location. It does not support `-WhatIf` or `-Confirm` because it does not declare `SupportsShouldProcess`.

## Output

The function returns one `System.String` containing the absolute `ModuleBase` path of the loaded OSDeploy module.

Assign the result directly when another command requires a path:

```powershell
$OSDeployModulePath = Get-OSDeployModulePath
```

See [Module Setup](/guide/requirements/powershell-modules.md) for the installation workflow or the [Get-OSDeployModulePath command reference](/command-reference/osdeploy/get-osdeploymodulepath.md) for compact syntax and output information.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.osdeploy.com/guide/cmdlets/get-osdeploymodulepath.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
