# OSDHelp

In a nutshell, **`OSDHelp`** is a PowerShell function (**`Get-OSDHelp`**) that opens a GitHub Repository in **`OSDPad`**.  My goal is to populate this with PowerShell Scripts that can help you perform tasks, or learn a little PowerShell.  Any script in OSDHelp can be edited and customized before you run it

## Install

To install and use **`OSDHelp`**, you need to first install the OSD PowerShell Module.  Use the following commands in PowerShell (as Admin)

```
Install-Module OSD -Force
Import-Module OSD -Force
```

If you are in OOBE, you can do this from the Command Prompt using these commands.  You will need to press Shift + F10 to open a Command Prompt first

```
PowerShell
Set-ExecutionPolicy RemoteSigned -Force
Install-Module OSD -Force
Import-Module OSD -Force
```

## Usage

**`OSDHelp`** can be run using either of the following commands.  It is strongly recommended that you always run OSDHelp in an Elevated PowerShell session as many of the scripts require Admin Rights

```
OSDHelp
Get-OSDHelp
```

These commands are equivalent to the following **`OSDPad`** command line.  In a nutshell, **`OSDHelp`** is really just a shortcut for **`OSDPad`**

```
OSDPad -RepoOwner OSDeploy -RepoName OSDHelp
```

{% hint style="warning" %}
Content in OSDHelp changes frequently to add or update scripts
{% endhint %}

## RepoFolder

**`OSDHelp`** scripts are organized in directories in the GitHub Repository.  These directories are also known as a **`RepoFolder`**.  If you run **`OSDHelp`** without specifying a **`RepoFolder`**, you are simply presented with a **`Readme.md`** which serves as an Index so you know what RepoFolders are available

![](/files/-MhHIMP2RC-6py3Bs5ea)

You can also look in the minimized PowerShell Console and see the GitHub Directories (**`RepoFolder`**)

![](/files/-MhHKYC3azcbbKFF6PvE)

Now that you know what **RepoFolder** you can use, simply close **`OSDHelp`** (**`OSDPad`**) and go back to PowerShell and give it a try

```
OSDHelp Autopilot
```

## Script Dependencies

Scripts may require a Script or a Module install before executing.  You can see how this is done in the following OSDHelp Script

```
#Requires -RunAsAdministrator
#================================================
#   Install Script
#================================================
if (!(Get-Command Get-WindowsAutoPilotInfo -ErrorAction Ignore)) {
    Install-Script Get-WindowsAutoPilotInfo -Force -Verbose
}
#================================================
#   Parameters
#   [[-Name] <String[]>]
#   [-OutputFile <String>]
#   [-GroupTag <String>]
#   [-AssignedUser <String>] 
#   [-Append]
#   [-Credential <PSCredential>]
#   [-Partner]
#   [-Force]
#   -Online
#   [-TenantId <String>]
#   [-AppId <String>]
#   [-AppSecret <String>]
#   [-AddToGroup <String>] 
#   [-AssignedComputerName <String>]
#   [-Assign]
#   [-Reboot]
#================================================
& "$env:ProgramFiles\WindowsPowerShell\Scripts\Get-WindowsAutoPilotInfo.ps1"
```

## Script Transcript Logging

Many of the scripts will save a Transcript.  In most cases, these are saved in Windows Temp or User Temp.  In the following script in particular, this is saved in C:\Temp so the Transcript can be retreived by a Standard User.  This is by design

```
#Requires -RunAsAdministrator
#================================================
#   Initialize
#================================================
$Title = 'EventMonitor_Autopilot'
$host.ui.RawUI.WindowTitle = $Title
$host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.size(2000,2000)
#================================================
#   Temp
#================================================
if (!(Test-Path "$env:SystemDrive\Temp")) {
    New-Item -Path "$env:SystemDrive\Temp" -ItemType Directory -Force
}
#================================================
#   Transcript
#================================================
$Transcript = "$((Get-Date).ToString('yyyy-MM-dd-HHmmss'))-$Title.log"
Start-Transcript -Path (Join-Path "$env:SystemDrive\Temp" $Transcript) -ErrorAction Ignore
#================================================
```

## GitHub Reposository

If you're insterested, here is the **`OSDHelp`** Script Repository on GitHub

{% embed url="<https://github.com/OSDeploy/OSDHelp>" %}

## Sponsor

{% embed url="<https://www.recastsoftware.com/?utm_source=osdeploy&utm_medium=ad&utm_campaign=web>" %}
OSDeploy is sponsored by Recast Software
{% endembed %}


---

# Agent Instructions: 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:

```
GET https://osd.osdeploy.com/docs/osdhelp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
