-
Notifications
You must be signed in to change notification settings - Fork 0
Using in a SCCM Package
Daniel Thompson edited this page Apr 12, 2024
·
9 revisions
This is one way for adding this module into an SCCM package. You may modify it according to your needs, or do something else. You do you.
- Create a directory inside your package to hold this and other Git projects you may want to use. Lets call this
Git
. If you already have such a directory, you obviously can skip this step and use that directory. - Install Git on the computer you will be using to edit your package, and add the
git
executable to your path. Details on how to do this are beyond the scope of this article. - Use Git to download this repository:
- Open a command shell (such as Terminal, Command Prompt, or PowerShell).
- Change into the
Git
directory. - Pull down the latest version of the module with the following command:
git clone https://github.com/cwru-non-academic/posh-sccmtstools.git
- Your directory structure should look like:
-
Git
-
posh-sccmtstools
-
SCCMTSTools
-
1.0.0
Functions
-
-
-
-
- Remember to redistribute your package to your distribution points at some point after adding this module.
If you followed the instructions above for adding the module to your package, to update the module:
- Delete the existing
posh-sccmtstools
directory (Git doesn't seem to like cloning over an old copy of the repository). - Open a command shell (such as Terminal, Command Prompt, or PowerShell).
- Change into the
Git
directory. - Update the module with the following command:
git clone https://github.com/cwru-non-academic/posh-sccmtstools.git
- Remember to redistribute your package to your distribution points at some point after updating this module.
- Determine if the function(s) you are using is/are interactive in that function's help or in the Function Reference page in this wiki. Don't mix calls to interactive and non-interactive functions in the same script file.
- Import the module before you call any of its functions. If you set things up as recommended above, you can use this line of code:
Import-Module -Name "$PSScriptRoot\Git\posh-sccmtools\SCCMTSTools"
- Call functions as needed from a PowerShell script file. We will assume this lives in the root of your SCCM package. Then follow the instructions in the appropriate section below.
- You will need the ServiceUI executable or some other executable that can run
powershell.exe
interactively in your package or in the path in your boot media. Doing this is outside the scope of this documentation. A quick web search should come up with instructions. Here, we will assume ServiceUI has been put into the root of your package asServiceUI.exe
. - Add a Run Command Line step to your task sequence, giving it an appropriate name and description.
- Determine the path to
powershell.exe
in your boot media:- If your step is run before the computer has been booted into the installed OS (usually before execution of the Setup Windows and ConfigMgr step), this will be
X:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
. - If your step is run after the computer has been booted into the installed OS (usually after execution of the Setup Windows and ConfigMgr step), this will be
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
.
- If your step is run before the computer has been booted into the installed OS (usually before execution of the Setup Windows and ConfigMgr step), this will be
- For the Command line field, type in the following, replacing PWSPath with the path to
powershell.exe
and ScriptName with the name of your script file. You can remove the-ExecutionPolicy Bypass
bit if you have set up script signing.ServiceUI.exe -Process:TSProgressUI.exe _PWSPath_ -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File _ScriptName_
- Check the Package option, and use the [Browse] button by it to browse to your package.
- Make any other modifications you need.
- Add a Run PowerShell Script step to your task sequence, giving it an appropriate name and description.
- Pick Select a package with a PowerShell script, and use the [Browse] button to browse to your package.
- For Script Name, enter the name of your script.
- For PowerShell execution policy, pick Bypass, unless you have set up script signing (outside the scope of this article).
- Make any other modifications you need.