├── MDTApplicationTools.psd1 ├── Tests └── Module.Tests.ps1 ├── Media ├── ModuleInstallation.png └── PSGalleryInstallation.png ├── appveyor.yml ├── docs ├── Import-MDTModule.md ├── Get-MDTDrive.md ├── Set-MDTDrive.md ├── Find-MDTApplicationContent.md ├── Get-MDTApplicationSupportedPlatform.md ├── Get-MDTApplication.md ├── Get-MDTApplicationDependency.md ├── Rename-MDTApplication.md └── Set-MDTApplicationSupportedPlatform.md ├── LICENSE.md ├── README.md ├── MDTApplicationTools.format.ps1xml ├── MDTApplicationTools.psm1 └── en-US └── MDTApplicationTools-help.xml /MDTApplicationTools.psd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnForet/MDTApplicationTools/HEAD/MDTApplicationTools.psd1 -------------------------------------------------------------------------------- /Tests/Module.Tests.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnForet/MDTApplicationTools/HEAD/Tests/Module.Tests.ps1 -------------------------------------------------------------------------------- /Media/ModuleInstallation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnForet/MDTApplicationTools/HEAD/Media/ModuleInstallation.png -------------------------------------------------------------------------------- /Media/PSGalleryInstallation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnForet/MDTApplicationTools/HEAD/Media/PSGalleryInstallation.png -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | build: false 2 | 3 | install: 4 | - cinst pester 5 | 6 | test_script: 7 | - ps: Invoke-Pester -EnableExit 8 | -------------------------------------------------------------------------------- /docs/Import-MDTModule.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: 4 | schema: 2.0.0 5 | --- 6 | 7 | # Import-MDTModule 8 | ## SYNOPSIS 9 | {{Fill in the Synopsis}} 10 | 11 | ## SYNTAX 12 | 13 | ``` 14 | Import-MDTModule 15 | ``` 16 | 17 | ## DESCRIPTION 18 | {{Fill in the Description}} 19 | 20 | ## EXAMPLES 21 | 22 | ### Example 1 23 | ``` 24 | PS C:\> {{ Add example code here }} 25 | ``` 26 | 27 | {{ Add example description here }} 28 | 29 | ## PARAMETERS 30 | 31 | ## INPUTS 32 | 33 | ### None 34 | 35 | 36 | ## OUTPUTS 37 | 38 | ### System.Object 39 | 40 | ## NOTES 41 | 42 | ## RELATED LINKS 43 | 44 | -------------------------------------------------------------------------------- /docs/Get-MDTDrive.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: 4 | schema: 2.0.0 5 | --- 6 | 7 | # Get-MDTDrive 8 | ## SYNOPSIS 9 | {{Fill in the Synopsis}} 10 | 11 | ## SYNTAX 12 | 13 | ``` 14 | Get-MDTDrive [-Name] 15 | ``` 16 | 17 | ## DESCRIPTION 18 | {{Fill in the Description}} 19 | 20 | ## EXAMPLES 21 | 22 | ### Example 1 23 | ``` 24 | PS C:\> {{ Add example code here }} 25 | ``` 26 | 27 | {{ Add example description here }} 28 | 29 | ## PARAMETERS 30 | 31 | ### -Name 32 | {{Fill Name Description}} 33 | 34 | ```yaml 35 | Type: Object 36 | Parameter Sets: (All) 37 | Aliases: 38 | 39 | Required: True 40 | Position: 0 41 | Default value: 42 | Accept pipeline input: False 43 | Accept wildcard characters: False 44 | ``` 45 | 46 | ## INPUTS 47 | 48 | ### None 49 | 50 | 51 | ## OUTPUTS 52 | 53 | ### System.Object 54 | 55 | ## NOTES 56 | 57 | ## RELATED LINKS 58 | 59 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright (c) 2016 John Foret 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MDT Application Tools 2 | A PowerShell module to provide enhanced functionality around the querying and manipulation of MDT applications. 3 | 4 | [![Build status](https://ci.appveyor.com/api/projects/status/github/JohnForet/mdtapplicationtools?branch=master&svg=true)](https://ci.appveyor.com/project/JohnForet/mdtapplicationtools/branch/master) 5 | 6 | ### Motivation 7 | This module was created to provide some advanced functionality around the manipulation of MDT applications. Some of the Functions included are: 8 | 9 | * Get-MDTApplication 10 | * Retrieves MDT applications, either by name/guid, or just all of them. 11 | * Get-MDTApplicationDependency 12 | * Retrieves either the parent or child dependencies of an MDT application. Can either return one depth, or can recurse the entire depth of the dependency tree 13 | * Get-MDTApplicationSupportedPlatform 14 | * Queries MDT applications to see if they have the SupportedPlatform attribute set. 15 | * Set-MDTApplicationSupportedPlatform 16 | * Sets the SupportedPlatform attribute on MDT applications 17 | * Find-MDTApplicationContent 18 | * Searches through either the installcmd attribute or the install scripts themselves of all the MDT applications in a share for the specified string(i.e "pause", "powershell.exe", "C:\Program Files (x86)", etc.) 19 | * Rename-MDTApplication 20 | * Renames MDT applications, optionally renaming their source directory in MDT as well. 21 | 22 | ### Prerequisites 23 | 24 | In order to run this module, you'll need to at least have the **Microsoft Deployment Toolkit** installed. As of this writing the module has only been tested with **MDT 2013 Update 1** and **Update 2**, but may possibly work with earlier iterations of the toolkit. This module was developed on **Windows 10** using **PowerShell 5**. It will probably work just fine with earlier versions of Windows and PowerShell, but bear in mind those scenarios are untested. 25 | 26 | ###### MDT 2013 Update 1 27 | http://www.microsoft.com/en-us/download/details.aspx?id=48595 28 | 29 | ###### MDT 2013 Update 2 30 | http://www.microsoft.com/en-us/download/details.aspx?id=50407 31 | 32 | 33 | ### Installing 34 | 35 | In order to install this module, just copy the module folder `MDTApplicationTools` (in order for the module to be imported it's contents must be in this folder) to one the folders in `$env:PSModulePath`. 36 | Here's an example of what it should look like: 37 | 38 | ![Module Installation Directory](Media/ModuleInstallation.png) 39 | 40 | If you have PowerShell 5, you can also install it directly from the PowerShell Gallery. 41 | 42 | ![PowerShell Gallery Installation](Media/PSGalleryInstallation.png) 43 | 44 | ### Updating Help 45 | The help in this module is maintained with [platyPS](https://github.com/PowerShell/platyPS), which is a powershell module that lets you generate external powershell help files from easily maintained markdown file(s). In order to update the help in this module, simply edit the markdown file for the function in `.\docs` in the module's root directory, afterwards running `New-ExternalHelp .\docs -OutputPath en-US\ -Force`. This command will update the external help file for the module, `.\en-US\MDTApplicationTools-help.xml`. 46 | 47 | ### Authors 48 | 49 | * **John Foret** - *Initial work* - [JohnForet](https://github.com/JohnForet) 50 | 51 | ### License 52 | 53 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 54 | 55 | ### Acknowledgments 56 | 57 | Hat's off to Don Jones and Jeffrey Hicks *Learn Powershell Toolmaking in a Month of Lunches*, which helped me write this module. Also, kudos to Johan Arwidmark and Mikael Nystrom, both for the book *Deployment Fundamentals Vol 4: Deploying Windows 8 and Office 2013 Using MDT 2012 Update 1*, and for the support they provide to the windows deployment community. 58 | -------------------------------------------------------------------------------- /docs/Set-MDTDrive.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Set-MDTDrive.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # Set-MDTDrive 8 | ## SYNOPSIS 9 | Creates an MDT drive. 10 | 11 | ## SYNTAX 12 | 13 | ``` 14 | Set-MDTDrive [-Name] [-Path] [-Force] [-WhatIf] [-Confirm] 15 | ``` 16 | 17 | ## DESCRIPTION 18 | The Set-MDTDrive function creates an MDT drive using the MDTProvider for powershell. This function is actually just a wrapper for New-PSDrive with the MDTProvider. For example this: 19 | 20 | `PS C:\>Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$"` 21 | 22 | is actually the same command as this: 23 | 24 | `PS C:\>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\\FILESERVER\MDTProduction$" -NetworkPath "\\FILESERVER\MDTProduction$" -Scope Global` 25 | 26 | ## EXAMPLES 27 | 28 | ### Example 1: Create an MDT drive 29 | ``` 30 | PS C:\> Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$" 31 | ``` 32 | 33 | Creates an MDT Drive with a name of `MDTProduction` and a path of `"\\FILESERVER\MDTProduction$"` 34 | ### Example 2: Create an MDT drive, overwriting previous drives 35 | ``` 36 | PS C:\> Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$" -Force 37 | ``` 38 | 39 | Creates an MDT Drive with a name of `MDTProduction` and a path of `"\\FILESERVER\MDTProduction$"`, overwriting any previous drives with the name `MDTProduction`. 40 | ### Example 3: Shows what will happen if the command is run 41 | ``` 42 | PS C:\> Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$" -WhatIf 43 | ``` 44 | 45 | Shows what will happen if you try to create an MDT Drive with a name of `MDTProduction` and a path of `"\\FILESERVER\MDTProduction$"` 46 | ## PARAMETERS 47 | 48 | ### -Confirm 49 | The confirm preference. If left alone, will just let the command run as normal. If $true is specified, will prompt you before creating the drive. 50 | 51 | 52 | ```yaml 53 | Type: SwitchParameter 54 | Parameter Sets: (All) 55 | Aliases: cf 56 | 57 | Required: False 58 | Position: Named 59 | Default value: 60 | Accept pipeline input: False 61 | Accept wildcard characters: False 62 | ``` 63 | 64 | ### -Force 65 | If specified, will create MDT drive even if one with same name already exists(in case one wants to create a drive of the same name with a different path) 66 | 67 | ```yaml 68 | Type: SwitchParameter 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: Named 74 | Default value: 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### -Name 80 | Specifies what name you would like to give to the drive you want to create. This is the share name you'll reference later on when querying the share. 81 | 82 | ```yaml 83 | Type: Object 84 | Parameter Sets: (All) 85 | Aliases: 86 | 87 | Required: True 88 | Position: 0 89 | Default value: 90 | Accept pipeline input: False 91 | Accept wildcard characters: False 92 | ``` 93 | 94 | ### -Path 95 | {{Fill Path Description}} 96 | 97 | ```yaml 98 | Type: Object 99 | Parameter Sets: (All) 100 | Aliases: 101 | 102 | Required: True 103 | Position: 1 104 | Default value: 105 | Accept pipeline input: False 106 | Accept wildcard characters: False 107 | ``` 108 | 109 | ### -WhatIf 110 | If specified, will output what changes the command will make without making them. 111 | 112 | ```yaml 113 | Type: SwitchParameter 114 | Parameter Sets: (All) 115 | Aliases: wi 116 | 117 | Required: False 118 | Position: Named 119 | Default value: 120 | Accept pipeline input: False 121 | Accept wildcard characters: False 122 | ``` 123 | 124 | ## INPUTS 125 | 126 | ### None 127 | 128 | 129 | ## OUTPUTS 130 | 131 | ### System.Object 132 | 133 | ## NOTES 134 | 135 | ## RELATED LINKS 136 | -------------------------------------------------------------------------------- /docs/Find-MDTApplicationContent.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Find-MDTApplicationContent.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # Find-MDTApplicationContent 8 | ## SYNOPSIS 9 | Searches MDT shares for applications whose content contain specified text. 10 | 11 | ## SYNTAX 12 | 13 | ``` 14 | Find-MDTApplicationContent [-ShareName] [[-String] ] [-ParseScript] 15 | ``` 16 | 17 | ## DESCRIPTION 18 | The Find-MDTApplicationContent function retrieves MDT applications from the specified MDT share that contain the string specified. It can query either just the CommandLine attribute of the application, or it can also query the install scripts themselves if the ParseScript switch is specified. 19 | 20 | ## EXAMPLES 21 | 22 | ### Example 1 23 | ``` 24 | PS C:\> Find-MDTApplicationContent -ShareName MDTProduction -string "setup.exe /s" 25 | ``` 26 | 27 | This command searches the MDT share MDTProduction, and returns any applications where the "CommandLine" attribute matches "setup.exe /s" exactly. 28 | 29 | ### Example 2 30 | ``` 31 | PS C:\> Find-MDTApplicationContent -ShareName MDTProduction -string *.bat* 32 | ``` 33 | 34 | This command searches the MDT share MDTProduction, and returns any applications that call a .bat file in their "CommandLine" attribute 35 | ### Example 3 36 | ``` 37 | PS C:\> Find-MDTApplicationContent -ShareName MDTProduction -string "C:\Program Files\*" -ParseScript 38 | ``` 39 | 40 | This command searches the MDT share MDTProduction, and returns any applications that call a .bat file in their "CommandLine" attribute 41 | 42 | ## PARAMETERS 43 | 44 | ### -ParseScript 45 | **IF NOT** specified, the only part of the apps that are searched are the "CommandLine" attribute, which is the initial command that gets launched at install time to install the app(it can reference either an executable or an install script path). **IF** specified, the script will actually go through the applications working directory, and parse through any install scripts to see if they contain the specified string. It searches the following files: 46 | 47 | ".bat",".cmd",".vbs",".wsf",".ps1",".psm1",".psd1" 48 | 49 | ```yaml 50 | Type: SwitchParameter 51 | Parameter Sets: (All) 52 | Aliases: 53 | 54 | Required: False 55 | Position: Named 56 | Default value: 57 | Accept pipeline input: False 58 | Accept wildcard characters: False 59 | ``` 60 | 61 | ### -ShareName 62 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 63 | 64 | `PS C:\>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\\FILESERVER\MDTProduction$" -NetworkPath "\\FILESERVER\MDTProduction$" -Scope Global` 65 | 66 | or 67 | 68 | `PS C:\>Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$"` 69 | 70 | ```yaml 71 | Type: Object 72 | Parameter Sets: (All) 73 | Aliases: 74 | 75 | Required: True 76 | Position: 0 77 | Default value: 78 | Accept pipeline input: False 79 | Accept wildcard characters: False 80 | ``` 81 | 82 | ### -String 83 | Specifies the string to search for in MDT applications. If typed explicitly (i.e. "setup.exe /s"), it will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like \*powershell.exe\* would return all the applications that have powershell.exe in their commandline or install script(depending on whether the ParseScript parameter was used). 84 | 85 | ```yaml 86 | Type: Object 87 | Parameter Sets: (All) 88 | Aliases: 89 | 90 | Required: False 91 | Position: 1 92 | Default value: 93 | Accept pipeline input: False 94 | Accept wildcard characters: True 95 | ``` 96 | 97 | ## INPUTS 98 | 99 | ### None 100 | 101 | 102 | ## OUTPUTS 103 | 104 | ### System.Object 105 | 106 | ## NOTES 107 | 108 | ## RELATED LINKS 109 | -------------------------------------------------------------------------------- /docs/Get-MDTApplicationSupportedPlatform.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Get-MDTApplicationSupportedPlatform.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # Get-MDTApplicationSupportedPlatform 8 | ## SYNOPSIS 9 | Gets the SupportedPlatform attribute of or more MDT applications 10 | 11 | ## SYNTAX 12 | 13 | ### GUIDFilter 14 | ``` 15 | Get-MDTApplicationSupportedPlatform [-ShareName ] -GUID -SupportedPlatformSet 16 | ``` 17 | 18 | ### NameFilter 19 | ``` 20 | Get-MDTApplicationSupportedPlatform [-ShareName ] -Name -SupportedPlatformSet 21 | ``` 22 | 23 | ### NoFilter 24 | ``` 25 | Get-MDTApplicationSupportedPlatform [-ShareName ] -SupportedPlatformSet 26 | ``` 27 | 28 | ## DESCRIPTION 29 | The Get-MDTApplicationSupportedPlatform function can either return the SupportedPlatform attribute of a queried application(via the name or GUID) parameter, return it for all applications, or return just applications that have it set(or not). 30 | 31 | ## EXAMPLES 32 | 33 | ### Example 1: Get all applications where the SupportedPlatform attribute is set(to anything) 34 | ``` 35 | PS C:\> Get-MDTApplicationSupportedPlatform -ShareName TESTSHARE -SupportedPlatformSet Yes 36 | ``` 37 | 38 | Returns all applications where SupportedPlatform is set. 39 | ### Example 2: Get all applications where the SupportedPlatform attribute is NOT set. 40 | ``` 41 | PS C:\> Get-MDTApplicationSupportedPlatform -ShareName TESTSHARE -SupportedPlatformSet No 42 | ``` 43 | 44 | Returns all applications where SupportedPlatform is NOT set. 45 | ### Example 3: Get SupportedPlatform attribute of specific application. 46 | ``` 47 | PS C:\> Get-MDTApplicationSupportedPlatform -ShareName TESTSHARE -Name "Install - Google Chrome -x64" -SupportedPlatformSet All 48 | ``` 49 | 50 | Returns the queried application along with it's SupportedPlatform attribute 51 | 52 | ## PARAMETERS 53 | 54 | ### -GUID 55 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 56 | 57 | ```yaml 58 | Type: Object 59 | Parameter Sets: GUIDFilter 60 | Aliases: 61 | 62 | Required: True 63 | Position: Named 64 | Default value: 65 | Accept pipeline input: True (ByPropertyName) 66 | Accept wildcard characters: True 67 | ``` 68 | 69 | ### -Name 70 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\*adobe\*" would return all the applications that have adobe in their name. 71 | 72 | ```yaml 73 | Type: Object 74 | Parameter Sets: NameFilter 75 | Aliases: 76 | 77 | Required: True 78 | Position: Named 79 | Default value: 80 | Accept pipeline input: True (ByPropertyName) 81 | Accept wildcard characters: True 82 | ``` 83 | 84 | ### -ShareName 85 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 86 | 87 | `PS C:\>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\\FILESERVER\MDTProduction$" -NetworkPath "\\FILESERVER\MDTProduction$" -Scope Global` 88 | 89 | or 90 | 91 | `PS C:\>Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$"` 92 | 93 | ```yaml 94 | Type: Object 95 | Parameter Sets: (All) 96 | Aliases: 97 | 98 | Required: False 99 | Position: Named 100 | Default value: 101 | Accept pipeline input: False 102 | Accept wildcard characters: False 103 | ``` 104 | 105 | ### -SupportedPlatformSet 106 | Specifies in the query whether to return just Applications that have it set(Yes), just Applications that do NOT have it set(No), or to return Applications that both states(All). 107 | 108 | ```yaml 109 | Type: Object 110 | Parameter Sets: (All) 111 | Aliases: 112 | Accepted values: Yes, No, All 113 | 114 | Required: True 115 | Position: Named 116 | Default value: All 117 | Accept pipeline input: False 118 | Accept wildcard characters: False 119 | ``` 120 | 121 | ## INPUTS 122 | 123 | ### System.Object 124 | 125 | 126 | ## OUTPUTS 127 | 128 | ### System.Object 129 | 130 | ## NOTES 131 | 132 | ## RELATED LINKS 133 | -------------------------------------------------------------------------------- /docs/Get-MDTApplication.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Get-MDTApplication.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # Get-MDTApplication 8 | ## SYNOPSIS 9 | Gets one or more MDT applications 10 | 11 | ## SYNTAX 12 | 13 | ### GUIDFilter 14 | ``` 15 | Get-MDTApplication [-ShareName ] [-Location ] -GUID 16 | ``` 17 | 18 | ### NameFilter 19 | ``` 20 | Get-MDTApplication [-ShareName ] [-Location ] -Name 21 | ``` 22 | 23 | ### NoFilter 24 | ``` 25 | Get-MDTApplication [-ShareName ] [-Location ] 26 | ``` 27 | 28 | ## DESCRIPTION 29 | The Get-MDTApplication function retrieves MDT applications from the specified MDT share. It can be used to either retrieve all the applications at once, or just by the applications Name or GUID of the wanted application. 30 | 31 | ## EXAMPLES 32 | 33 | ### Example 1: Get all applications 34 | ``` 35 | PS C:\>Get-MDTApplication -ShareName MDTProduction 36 | ``` 37 | 38 | This command returns all applications from the MDT share. 39 | ### Example 2: Get only applications in a certain directory 40 | ``` 41 | PS C:\>Get-MDTApplication -ShareName MDTProduction -Location "APPBUNDLES" 42 | ``` 43 | 44 | This command returns all applications from the MDT share that are located in a folder called "APPBUNDLES" (located under the Applications root folder). 45 | ### Example 3: Get application by name 46 | ``` 47 | PS C:\>Get-MDTApplication -ShareName MDTProduction -Name "Install - Java 8 - x64" 48 | ``` 49 | 50 | This command returns the application with the name "Install - Java 8 - x64" from the MDT share. 51 | ### Example 4: Use wildcards to search for applications 52 | ``` 53 | PS C:\>Get-MDTApplication -ShareName MDTProduction -Name *java* 54 | ``` 55 | 56 | This command returns any applications that have the word java somewhere in their name from the MDT share. 57 | ### Example 5: Get application by GUID 58 | ``` 59 | PS C:\>Get-MDTApplication -ShareName MDTProduction -GUID "{4deefc41-71c2-4f59-bcf7-89fd4629a025}" 60 | ``` 61 | 62 | This command returns the application with the GUID "4deefc41-71c2-4f59-bcf7-89fd4629a025" from the MDT share. 63 | 64 | ## PARAMETERS 65 | 66 | ### -GUID 67 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 68 | 69 | ```yaml 70 | Type: Object 71 | Parameter Sets: GUIDFilter 72 | Aliases: 73 | 74 | Required: True 75 | Position: Named 76 | Default value: 77 | Accept pipeline input: True (ByPropertyName) 78 | Accept wildcard characters: True 79 | ``` 80 | 81 | ### -Location 82 | Specifies that the query be restricted to a folder located within the Applications folder. Specifying "Install\Broken" for example would restrict the search to the folder "Applications\Install\Broken" in the MDT share. 83 | 84 | ```yaml 85 | Type: Object 86 | Parameter Sets: (All) 87 | Aliases: 88 | 89 | Required: False 90 | Position: Named 91 | Default value: 92 | Accept pipeline input: False 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### -Name 97 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\*adobe\*" would return all the applications that have adobe in their name. 98 | 99 | ```yaml 100 | Type: Object 101 | Parameter Sets: NameFilter 102 | Aliases: 103 | 104 | Required: True 105 | Position: Named 106 | Default value: 107 | Accept pipeline input: True (ByPropertyName) 108 | Accept wildcard characters: True 109 | ``` 110 | 111 | ### -ShareName 112 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 113 | 114 | `PS C:\>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\\FILESERVER\MDTProduction$" -NetworkPath "\\FILESERVER\MDTProduction$" -Scope Global` 115 | 116 | or 117 | 118 | `PS C:\>Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$"` 119 | 120 | ```yaml 121 | Type: Object 122 | Parameter Sets: (All) 123 | Aliases: 124 | 125 | Required: False 126 | Position: Named 127 | Default value: 128 | Accept pipeline input: False 129 | Accept wildcard characters: False 130 | ``` 131 | 132 | ## INPUTS 133 | 134 | ### System.Object 135 | 136 | 137 | ## OUTPUTS 138 | 139 | ### System.Object 140 | 141 | ## NOTES 142 | 143 | ## RELATED LINKS 144 | -------------------------------------------------------------------------------- /docs/Get-MDTApplicationDependency.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Get-MDTApplicationDependency.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # Get-MDTApplicationDependency 8 | ## SYNOPSIS 9 | Gets the application dependencies of or more MDT applications 10 | 11 | ## SYNTAX 12 | 13 | ### GUIDFilter 14 | ``` 15 | Get-MDTApplicationDependency [-ShareName ] [-DependencyType ] [-Recurse] -GUID 16 | ``` 17 | 18 | ### NameFilter 19 | ``` 20 | Get-MDTApplicationDependency [-ShareName ] [-DependencyType ] [-Recurse] -Name 21 | ``` 22 | 23 | ## DESCRIPTION 24 | The Get-MDTApplicationDependency function either returns all the applications that the application is dependent upon(applications that need to be installed before installing the queried application), or applications upon which the queried application is a dependency. It can go back either just one application, or can recurse the entire depth of the dependency tree. 25 | 26 | ## EXAMPLES 27 | 28 | ### Example 1: Get any direct parent dependencies of an app 29 | ``` 30 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" 31 | ``` 32 | 33 | Returns only applications that will be installed **directly before** the Java JDK is installed. 34 | ### Example 2: Get any direct child dependencies of an app 35 | ``` 36 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" -DependencyType ReturnChild 37 | ``` 38 | 39 | Returns only applications that will install the Java JDK **directly after** they themselves are installed 40 | ### Example 3: Get **all** parent dependencies of an app 41 | ``` 42 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" -Recurse 43 | ``` 44 | 45 | Returns all applications that need to be installed **before** the Java JDK is installed. 46 | ### Example 4: Get **all** child dependencies of an app 47 | ``` 48 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" -Recurse -DependencyType ReturnChild 49 | ``` 50 | 51 | Returns all applications that will be installed **after** the Java JDK is installed 52 | 53 | ## PARAMETERS 54 | 55 | ### -DependencyType 56 | Specifies whether to return the parent dependencies of the queried application(applications that need to be installed before installing the queried application), or to return the child dependencies of the queried application(applications where the queried application needs to be installed first). Possible options are ReturnParent and ReturnChild. Default value is ReturnParent. 57 | 58 | ```yaml 59 | Type: Object 60 | Parameter Sets: (All) 61 | Aliases: 62 | Accepted values: ReturnParent, ReturnChild 63 | 64 | Required: False 65 | Position: Named 66 | Default value: ReturnParent 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### -GUID 72 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 73 | 74 | ```yaml 75 | Type: Object 76 | Parameter Sets: GUIDFilter 77 | Aliases: 78 | 79 | Required: True 80 | Position: Named 81 | Default value: 82 | Accept pipeline input: True (ByPropertyName) 83 | Accept wildcard characters: True 84 | ``` 85 | 86 | ### -Name 87 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\*adobe\*" would return all the applications that have adobe in their name. 88 | 89 | ```yaml 90 | Type: Object 91 | Parameter Sets: NameFilter 92 | Aliases: 93 | 94 | Required: True 95 | Position: Named 96 | Default value: 97 | Accept pipeline input: True (ByPropertyName) 98 | Accept wildcard characters: True 99 | ``` 100 | 101 | ### -Recurse 102 | If specified recurses the dependency tree until it reaches the last dependency. If not, only finds dependencies that are one depth away. 103 | 104 | ```yaml 105 | Type: SwitchParameter 106 | Parameter Sets: (All) 107 | Aliases: 108 | 109 | Required: False 110 | Position: Named 111 | Default value: 112 | Accept pipeline input: False 113 | Accept wildcard characters: False 114 | ``` 115 | 116 | ### -ShareName 117 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 118 | 119 | `PS C:\>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\\FILESERVER\MDTProduction$" -NetworkPath "\\FILESERVER\MDTProduction$" -Scope Global` 120 | 121 | or 122 | 123 | `PS C:\>Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$"` 124 | 125 | ```yaml 126 | Type: Object 127 | Parameter Sets: (All) 128 | Aliases: 129 | 130 | Required: False 131 | Position: Named 132 | Default value: 133 | Accept pipeline input: False 134 | Accept wildcard characters: False 135 | ``` 136 | 137 | ## INPUTS 138 | 139 | ### System.Object 140 | 141 | 142 | ## OUTPUTS 143 | 144 | ### System.Object 145 | 146 | ## NOTES 147 | 148 | ## RELATED LINKS 149 | -------------------------------------------------------------------------------- /docs/Rename-MDTApplication.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Rename-MDTApplication.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # Rename-MDTApplication 8 | ## SYNOPSIS 9 | Renames an MDT application. 10 | 11 | ## SYNTAX 12 | 13 | ### GUIDFilter 14 | ``` 15 | Rename-MDTApplication [-ShareName ] -GUID [-NewName ] [-RenameSource] [-Force] 16 | [-WhatIf] [-Confirm] 17 | ``` 18 | 19 | ### NameFilter 20 | ``` 21 | Rename-MDTApplication [-ShareName ] -Name [-NewName ] [-RenameSource] [-Force] 22 | [-WhatIf] [-Confirm] 23 | ``` 24 | 25 | ## DESCRIPTION 26 | The Rename-MDTApplication function renames an MDT application, optionally also renaming the source directory if the applications source files have been imported into MDT. Applications to be renamed can be specified by either their Name or their GUID. 27 | 28 | ## EXAMPLES 29 | 30 | ### Example 1: Rename an application 31 | ``` 32 | PS C:\> Rename-MDTApplication -ShareName MDTProduction -Name "APP1" -NewName "APP2" 33 | ``` 34 | 35 | Renames APP1 to APP2(changes the "Name" and "ShortName" attributes) 36 | ### Example 2: Rename an application, also renaming it's source directory 37 | ``` 38 | PS C:\> Rename-MDTApplication -ShareName MDTProduction -Name "APP1" -NewName "APP2" -RenameSource 39 | ``` 40 | 41 | Renames APP1 to APP2, also changing the source directory name from APP1 to APP2(changes the "Name", "ShortName", "Source", and "WorkingDirectory" attributes, also renaming the source directory itself) 42 | ### Example 3: Rename an application, also renaming it's source directory 43 | ``` 44 | PS C:\> Rename-MDTApplication -ShareName MDTProduction -Name "APP1" -NewName "APP2" -Force 45 | ``` 46 | 47 | Renames APP1 to APP2, with the Force parameter disabling the check to see if the application to be renamed exists in the MDT share, and also the check to see if the New Name is already in use by another MDT application. Use with caution. 48 | 49 | ## PARAMETERS 50 | 51 | ### -Confirm 52 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 53 | 54 | ```yaml 55 | Type: SwitchParameter 56 | Parameter Sets: (All) 57 | Aliases: cf 58 | 59 | Required: False 60 | Position: Named 61 | Default value: $true 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -Force 67 | If specified, disables the checks to verify that 1: the app to be renamed exists and 2: that new name isn't already in use. Use carefully. 68 | 69 | ```yaml 70 | Type: SwitchParameter 71 | Parameter Sets: (All) 72 | Aliases: 73 | 74 | Required: False 75 | Position: Named 76 | Default value: $false 77 | Accept pipeline input: False 78 | Accept wildcard characters: False 79 | ``` 80 | 81 | ### -GUID 82 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 83 | 84 | ```yaml 85 | Type: Object 86 | Parameter Sets: GUIDFilter 87 | Aliases: 88 | 89 | Required: True 90 | Position: Named 91 | Default value: 92 | Accept pipeline input: True (ByPropertyName) 93 | Accept wildcard characters: False 94 | ``` 95 | 96 | ### -Name 97 | Specifies the Name of an application to query the MDT share for. Alternate to GUID Parameter. 98 | 99 | ```yaml 100 | Type: Object 101 | Parameter Sets: NameFilter 102 | Aliases: 103 | 104 | Required: True 105 | Position: Named 106 | Default value: 107 | Accept pipeline input: True (ByPropertyName) 108 | Accept wildcard characters: False 109 | ``` 110 | 111 | ### -NewName 112 | Specifies what the new name of the application will be once renamed. Rename-MDTApplication will check the existing applications to make sure there are no duplicates before making any changes. 113 | 114 | ```yaml 115 | Type: Object 116 | Parameter Sets: (All) 117 | Aliases: 118 | 119 | Required: True 120 | Position: Named 121 | Default value: 122 | Accept pipeline input: False 123 | Accept wildcard characters: False 124 | ``` 125 | 126 | ### -RenameSource 127 | If specified, will also rename the actual application source folder inside of the MDT share. This parameter will only process if the application has it's source files located within the MDT share(the three MDT app types are "apps with source files", "apps with sources on network or elsewhere", and "app bundles". this parameter only processes the first of these three). 128 | 129 | ```yaml 130 | Type: SwitchParameter 131 | Parameter Sets: (All) 132 | Aliases: 133 | 134 | Required: False 135 | Position: Named 136 | Default value: $false 137 | Accept pipeline input: False 138 | Accept wildcard characters: False 139 | ``` 140 | 141 | ### -ShareName 142 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 143 | 144 | `PS C:\>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\\FILESERVER\MDTProduction$" -NetworkPath "\\FILESERVER\MDTProduction$" -Scope Global` 145 | 146 | or 147 | 148 | `PS C:\>Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$"` 149 | 150 | ```yaml 151 | Type: Object 152 | Parameter Sets: (All) 153 | Aliases: 154 | 155 | Required: True 156 | Position: Named 157 | Default value: 158 | Accept pipeline input: False 159 | Accept wildcard characters: False 160 | ``` 161 | 162 | ### -WhatIf 163 | If specified, will output what changes the command will make without making them. 164 | 165 | ```yaml 166 | Type: SwitchParameter 167 | Parameter Sets: (All) 168 | Aliases: wi 169 | 170 | Required: False 171 | Position: Named 172 | Default value: 173 | Accept pipeline input: False 174 | Accept wildcard characters: False 175 | ``` 176 | 177 | ## INPUTS 178 | 179 | ### System.Object 180 | 181 | 182 | ## OUTPUTS 183 | 184 | ### System.Object 185 | 186 | ## NOTES 187 | 188 | ## RELATED LINKS 189 | -------------------------------------------------------------------------------- /docs/Set-MDTApplicationSupportedPlatform.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: MDTApplicationTools-help.xml 3 | online version: https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Set-MDTApplicationSupportedPlatform.md 4 | schema: 2.0.0 5 | --- 6 | 7 | # Set-MDTApplicationSupportedPlatform 8 | ## SYNOPSIS 9 | Sets the SupportedPlatform attribute of or more MDT applications 10 | 11 | ## SYNTAX 12 | 13 | ### GUIDFilter 14 | ``` 15 | Set-MDTApplicationSupportedPlatform [-ShareName ] -GUID [-SetSupportedPlatformTo ] 16 | [-WhatIf] [-Confirm] 17 | ``` 18 | 19 | ### NameFilter 20 | ``` 21 | Set-MDTApplicationSupportedPlatform [-ShareName ] -Name [-SetSupportedPlatformTo ] 22 | [-WhatIf] [-Confirm] 23 | ``` 24 | 25 | ### NoFilter 26 | ``` 27 | Set-MDTApplicationSupportedPlatform [-ShareName ] [-SetSupportedPlatformTo ] [-WhatIf] 28 | [-Confirm] 29 | ``` 30 | 31 | ## DESCRIPTION 32 | The Set-MDTApplicationSupportedPlatform function sets the SupportedPlatform attribute on one or more MDT applications. It can either set the attribute to Null, or can set it to one of the predefined OS's. The OS restriction types are a bit more granular when setting this attribute via MDT's GUI, so due to the complexity behind scripting each one, broader "catch-all" types are used. At the moment this tool also disregards any previous settings of the attribute, so any previous settings will be overwritten with the new data specified by the command. 33 | 34 | ## EXAMPLES 35 | 36 | ### Example 1: Remove OS restriction for ALL applications in MDT Share 37 | ``` 38 | PS C:\> Set-MDTApplicationSupportedPlatform -ShareName MDTProduction -SetSupportedPlatformTo Null 39 | ``` 40 | 41 | Removes the OS restriction for ALL applications in MDTProduction (add a -confirm:$false on the end to remove prompts for each application) 42 | ### Example 2: Set ALL applications in share to Windows 7 43 | ``` 44 | PS C:\> Set-MDTApplicationSupportedPlatform -ShareName MDTProduction -SetSupportedPlatformTo Windows7Only 45 | ``` 46 | 47 | Set OS restriction for ALL applications in MDTProduction to Windows 7(add a -confirm:$false on the end to remove prompts for each application) 48 | ### Example 3: Set one application to windows 10 49 | ``` 50 | PS C:\> Set-MDTApplicationSupportedPlatform -ShareName MDTProduction -Name "Install - Java Runtime Environment -x86" -SetSupportedPlatformTo Windows10Only 51 | ``` 52 | 53 | Set OS restriction for "Install - Java Runtime Environment -x86" in MDTProduction to Windows 10 54 | 55 | ## PARAMETERS 56 | 57 | ### -Confirm 58 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 59 | 60 | ```yaml 61 | Type: SwitchParameter 62 | Parameter Sets: (All) 63 | Aliases: cf 64 | 65 | Required: False 66 | Position: Named 67 | Default value: $true 68 | Accept pipeline input: False 69 | Accept wildcard characters: False 70 | ``` 71 | 72 | ### -GUID 73 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 74 | 75 | ```yaml 76 | Type: Object 77 | Parameter Sets: GUIDFilter 78 | Aliases: 79 | 80 | Required: True 81 | Position: Named 82 | Default value: 83 | Accept pipeline input: True (ByPropertyName) 84 | Accept wildcard characters: True 85 | ``` 86 | 87 | ### -Name 88 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\*adobe\*" would return all the applications that have adobe in their name. 89 | 90 | ```yaml 91 | Type: Object 92 | Parameter Sets: NameFilter 93 | Aliases: 94 | 95 | Required: True 96 | Position: Named 97 | Default value: 98 | Accept pipeline input: True (ByPropertyName) 99 | Accept wildcard characters: True 100 | ``` 101 | 102 | ### -SetSupportedPlatformTo 103 | Specifies what OS restriction to apply to the application(or to remove the restriction by selecting Null). The OS restriction types are a bit more granular when setting this attribute via MDT's GUI, so due to the complexity behind scripting each one, broader "catch-all" types are used. At the moment this tool also disregards any previous settings of the attribute, so any previous settings will be overwritten with the new data specified here. 104 | 105 | ```yaml 106 | Type: Object 107 | Parameter Sets: (All) 108 | Aliases: 109 | Accepted values: Null, Windows7Only, Windows8Only, Windows8.1Only, Windows10Only 110 | 111 | Required: False 112 | Position: Named 113 | Default value: 114 | Accept pipeline input: False 115 | Accept wildcard characters: False 116 | ``` 117 | 118 | ### -ShareName 119 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 120 | 121 | `PS C:\>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\\FILESERVER\MDTProduction$" -NetworkPath "\\FILESERVER\MDTProduction$" -Scope Global` 122 | 123 | or 124 | 125 | `PS C:\>Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$"` 126 | 127 | ```yaml 128 | Type: Object 129 | Parameter Sets: (All) 130 | Aliases: 131 | 132 | Required: False 133 | Position: Named 134 | Default value: 135 | Accept pipeline input: False 136 | Accept wildcard characters: False 137 | ``` 138 | 139 | ### -WhatIf 140 | If specified, will output what changes the command will make without making them. 141 | 142 | ```yaml 143 | Type: SwitchParameter 144 | Parameter Sets: (All) 145 | Aliases: wi 146 | 147 | Required: False 148 | Position: Named 149 | Default value: 150 | Accept pipeline input: False 151 | Accept wildcard characters: False 152 | ``` 153 | 154 | ## INPUTS 155 | 156 | ### System.Object 157 | 158 | 159 | ## OUTPUTS 160 | 161 | ### System.Object 162 | 163 | ## NOTES 164 | 165 | ## RELATED LINKS 166 | -------------------------------------------------------------------------------- /MDTApplicationTools.format.ps1xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationDependency.ParentDependency 6 | 7 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationDependency.ParentDependency 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Name 23 | 24 | 25 | ParentDependency 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationDependency.ChildDependency 35 | 36 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationDependency.ChildDependency 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Name 52 | 53 | 54 | ChildDependency 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform 64 | 65 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Name 81 | 82 | 83 | SupportedPlatform 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationContent.ParseScript 93 | 94 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationContent.ParseScript 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Name 113 | 114 | 115 | Script 116 | 117 | 118 | LinesFound 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationContent.InstallCmd 128 | 129 | Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationContent.InstallCmd 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | Name 145 | 146 | 147 | CommandLine 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /MDTApplicationTools.psm1: -------------------------------------------------------------------------------- 1 | Function Import-MDTModule { 2 | $MDTModuleInstallLocation = "C:\Program Files\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1" 3 | if (!(Get-Module MicrosoftDeploymentToolkit)) { 4 | if (Test-Path $MDTModuleInstallLocation) { 5 | Import-Module $MDTModuleInstallLocation 6 | } else { 7 | Write-Error "MDT module not working. Microsoft Deployment Toolkit may need to be installed." 8 | } 9 | } 10 | $return = Get-Module MicrosoftDeploymentToolkit 11 | return $return 12 | } 13 | 14 | Function Get-MDTDrive { 15 | [CmdletBinding()] 16 | param( 17 | [Parameter(Mandatory=$true)] 18 | $Name 19 | ) 20 | PROCESS{ 21 | if(Import-MDTModule) { 22 | $drive = Get-PSDrive -Name $Name -PSProvider MDTProvider 23 | return $drive 24 | } 25 | } 26 | } 27 | 28 | Function Set-MDTDrive { 29 | [cmdletbinding( 30 | SupportsShouldProcess=$true 31 | )] 32 | param( 33 | [Parameter(Mandatory=$true)] 34 | $Name, 35 | [Parameter(Mandatory=$true)] 36 | $Path, 37 | [Parameter()] 38 | [switch]$Force 39 | ) 40 | BEGIN { 41 | $mdtdrive = Get-MDTDrive -Name $Name -ErrorAction:SilentlyContinue 42 | if (Import-MDTModule) { 43 | if ($mdtdrive) { 44 | Write-Verbose "$Name already exists" 45 | if ($Force) { 46 | if ($PSCmdlet.ShouldProcess($env:COMPUTERNAME,"Creating MDT drive $Name with path $Path")) { 47 | Write-Verbose "Force switch specified. Overwriting drive $Name" 48 | New-PSDrive -Name $Name -PSProvider MDTProvider -Root $Path -NetworkPath $Path -Scope Global 49 | } 50 | } 51 | } elseif (!($mdtdrive)) { 52 | if ($PSCmdlet.ShouldProcess($env:COMPUTERNAME,"Creating MDT drive $Name with path $Path")) { 53 | Write-Verbose "Creating new drive: $Name : $Path" 54 | New-PSDrive -Name $Name -PSProvider MDTProvider -Root $Path -NetworkPath $Path -Scope Global 55 | } 56 | } 57 | } 58 | } 59 | } 60 | 61 | Function Get-MDTApplication { 62 | [cmdletbinding()] 63 | param( 64 | [Parameter(Mandatory=$true)] 65 | [Parameter(ParameterSetName='NoFilter')] 66 | [Parameter(ParameterSetName='NameFilter')] 67 | [Parameter(ParameterSetName='GUIDFilter')] 68 | $ShareName, 69 | [Parameter(ParameterSetName='NoFilter')] 70 | [Parameter(ParameterSetName='NameFilter')] 71 | [Parameter(ParameterSetName='GUIDFilter')] 72 | $Location, 73 | [Parameter(Mandatory=$true, 74 | ValueFromPipelineByPropertyName=$true, 75 | ParameterSetName='NameFilter')] 76 | $Name, 77 | [Parameter( 78 | Mandatory=$true, 79 | ValueFromPipelineByPropertyName=$true, 80 | ParameterSetName='GUIDFilter')] 81 | $GUID 82 | ) 83 | BEGIN { 84 | $mdtdriveworking = Get-MDTDrive -Name $ShareName 85 | if ($mdtdriveworking) { 86 | if ($null -eq $location) { 87 | $getchilditemquery = Get-ChildItem -Path $ShareName`:\Applications -Recurse | Where-Object {$_.NodeType -eq "Application"} 88 | } else { 89 | $getchilditemquery = Get-ChildItem -Path $ShareName`:\Applications\$location -Recurse | Where-Object {$_.NodeType -eq "Application"} 90 | } 91 | } 92 | } 93 | PROCESS { 94 | if ($mdtdriveworking) { 95 | switch ($PSCmdlet.ParameterSetName) { 96 | "NameFilter" { 97 | $appobject = $getchilditemquery | Where-Object {$_.Name -like $Name} 98 | Write-Output $appobject 99 | } 100 | "GUIDFilter" { 101 | if($GUID -notmatch "{*}") { 102 | $GUID = ("{" + $GUID + "}") 103 | } 104 | $appobject = $getchilditemquery | Where-Object {$_.GUID -like $GUID} 105 | Write-Output $appobject 106 | } 107 | "NoFilter" { 108 | Write-Output $getchilditemquery 109 | } 110 | } 111 | } 112 | } 113 | } 114 | 115 | Function Get-MDTApplicationDependency { 116 | [cmdletbinding()] 117 | param( 118 | [Parameter(Mandatory=$true)] 119 | [Parameter(ParameterSetName='NameFilter')] 120 | [Parameter(ParameterSetName='GUIDFilter')] 121 | $ShareName, 122 | [Parameter(ParameterSetName='NameFilter')] 123 | [Parameter(ParameterSetName='GUIDFilter')] 124 | [ValidateSet("ReturnParent","ReturnChild")] 125 | $DependencyType = "ReturnParent", 126 | [Parameter(ParameterSetName='NameFilter')] 127 | [Parameter(ParameterSetName='GUIDFilter')] 128 | [switch]$Recurse, 129 | [Parameter(Mandatory=$true, 130 | ValueFromPipelineByPropertyName=$true, 131 | ParameterSetName='NameFilter')] 132 | $Name, 133 | [Parameter( 134 | Mandatory=$true, 135 | ValueFromPipelineByPropertyName=$true, 136 | ParameterSetName='GUIDFilter')] 137 | $GUID 138 | ) 139 | BEGIN { 140 | switch ($PSCmdlet.ParameterSetName) { 141 | "NameFilter" { 142 | $sourceapp = Get-MDTApplication -ShareName $ShareName -Name $Name 143 | } 144 | "GUIDFilter" { 145 | if($GUID -notmatch "{*}") { 146 | $GUID = ("{" + $GUID + "}") 147 | } 148 | $sourceapp = Get-MDTApplication -ShareName $ShareName -GUID $GUID 149 | } 150 | } 151 | if ($DependencyType -eq "ReturnChild") { 152 | $allapplications = Get-MDTApplication -ShareName $ShareName 153 | } 154 | } 155 | PROCESS { 156 | switch ($DependencyType) { 157 | "ReturnParent" { 158 | foreach ($app in $sourceapp.dependency) { 159 | $appobject = Get-MDTApplication -ShareName $ShareName -GUID $app | Add-Member NoteProperty ParentDependency($sourceapp.Name) -PassThru 160 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationDependency.ParentDependency') 161 | Write-Output $appobject 162 | if ($Recurse -and $appobject.dependency) { 163 | Get-MDTApplicationDependency -ShareName $ShareName -GUID $app -DependencyType ReturnParent -Recurse 164 | } 165 | } 166 | } 167 | "ReturnChild" { 168 | foreach ($app in $allapplications) { 169 | if ($app.Dependency -contains $sourceapp.guid) { 170 | $appobject = Get-MDTApplication -ShareName $ShareName -GUID $app.guid | Add-Member NoteProperty ChildDependency($sourceapp.Name) -PassThru 171 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationDependency.ChildDependency') 172 | Write-Output $appobject 173 | if ($Recurse -and $appobject.dependency) { 174 | Get-MDTApplicationDependency -ShareName $ShareName -GUID $app.guid -DependencyType ReturnChild -Recurse 175 | } 176 | } 177 | } 178 | } 179 | } 180 | } 181 | } 182 | 183 | Function Get-MDTApplicationSupportedPlatform { 184 | [cmdletbinding()] 185 | param( 186 | [Parameter(Mandatory=$true)] 187 | [Parameter(ParameterSetName='NoFilter')] 188 | [Parameter(ParameterSetName='NameFilter')] 189 | [Parameter(ParameterSetName='GUIDFilter')] 190 | $ShareName, 191 | [Parameter(Mandatory=$true, 192 | ValueFromPipelineByPropertyName=$true, 193 | ParameterSetName='NameFilter')] 194 | $Name, 195 | [Parameter( 196 | Mandatory=$true, 197 | ValueFromPipelineByPropertyName=$true, 198 | ParameterSetName='GUIDFilter')] 199 | $GUID, 200 | [ValidateSet("Yes", "No", "All")] 201 | $SupportedPlatformSet = "All" 202 | ) 203 | PROCESS { 204 | switch ($PSCmdlet.ParameterSetName) { 205 | "NoFilter" { 206 | $basequery = Get-MDTApplication -ShareName $ShareName 207 | switch ($SupportedPlatformSet) { 208 | "Yes" {$appobject = $basequery | Where-Object {$_.SupportedPlatform -like "*"}} 209 | "No" {$appobject = $basequery | Where-Object {[string]$_.SupportedPlatform -like ""}} 210 | "All" {$appobject = $basequery} 211 | } 212 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform') 213 | Write-Output $appobject 214 | } 215 | "NameFilter" { 216 | $basequery = Get-MDTApplication -ShareName $ShareName -Name $Name 217 | switch ($SupportedPlatformSet) { 218 | "Yes" {$appobject = $basequery | Where-Object {$_.SupportedPlatform -like "*"}} 219 | "No" {$appobject = $basequery | Where-Object {[string]$_.SupportedPlatform -like ""}} 220 | "All" {$appobject = $basequery} 221 | } 222 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform') 223 | Write-Output $appobject 224 | } 225 | "GUIDFilter" { 226 | if($GUID -notmatch "{*}") { 227 | $GUID = ("{" + $GUID + "}") 228 | } 229 | $basequery = Get-MDTApplication -ShareName $ShareName -GUID $GUID 230 | switch ($SupportedPlatformSet) { 231 | "Yes" {$appobject = $basequery | Where-Object {$_.SupportedPlatform -like "*"}} 232 | "No" {$appobject = $basequery | Where-Object {[string]$_.SupportedPlatform -like ""}} 233 | "All" {$appobject = $basequery} 234 | } 235 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform') 236 | Write-Output $appobject 237 | } 238 | } 239 | } 240 | } 241 | 242 | Function Set-MDTApplicationSupportedPlatform { 243 | [cmdletbinding( 244 | SupportsShouldProcess=$true, 245 | ConfirmImpact="High" 246 | )] 247 | param( 248 | [Parameter(Mandatory=$true)] 249 | [Parameter(ParameterSetName='NoFilter')] 250 | [Parameter(ParameterSetName='NameFilter')] 251 | [Parameter(ParameterSetName='GUIDFilter')] 252 | $ShareName, 253 | [Parameter(Mandatory=$true, 254 | ValueFromPipelineByPropertyName=$true, 255 | ParameterSetName='NameFilter')] 256 | $Name, 257 | [Parameter( 258 | Mandatory=$true, 259 | ValueFromPipelineByPropertyName=$true, 260 | ParameterSetName='GUIDFilter')] 261 | $GUID, 262 | [Parameter(Mandatory=$true)] 263 | [Parameter(ParameterSetName='NoFilter')] 264 | [Parameter(ParameterSetName='NameFilter')] 265 | [Parameter(ParameterSetName='GUIDFilter')] 266 | [ValidateSet("Null", "Windows7Only", "Windows8Only", "Windows8.1Only", "Windows10Only")] 267 | $SetSupportedPlatformTo 268 | ) 269 | BEGIN { 270 | Switch ($SetSupportedPlatformTo) { 271 | "Null" {$code = @()} 272 | "Windows7Only" {$code = @('All x86 Windows 7 Client', 'All x64 Windows 7 Client')} 273 | "Windows8Only" {$code = @('All x86 Windows 8 Client', 'All x64 Windows 8 Client')} 274 | "Windows8.1Only" {$code = @('All x86 Windows 8.1 Client', 'All x64 Windows 8.1 Client') } 275 | "Windows10Only" {$code = @('All x86 Windows 10 Client', 'All x64 Windows 10 Client') } 276 | } 277 | } 278 | PROCESS { 279 | switch ($PSCmdlet.ParameterSetName) { 280 | "NoFilter" { 281 | $app = Get-MDTApplication -ShareName $ShareName 282 | if ($PSCmdlet.ShouldProcess($ShareName,"Setting Supported Platform to $SetSupportedPlatformTo on all applications")) { 283 | $appobject = $app | ForEach-Object {Set-ItemProperty -Path ([string]$_.PsPath -replace 'MicrosoftDeploymentToolkit\\MDTProvider::',"") -Name SupportedPlatform -Value $code} 284 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform') 285 | Write-Output $appobject 286 | } 287 | } 288 | "NameFilter" { 289 | $app = Get-MDTApplication -ShareName $ShareName -Name $Name 290 | $appname = $app.Name 291 | if ($PSCmdlet.ShouldProcess($ShareName,"Setting Supported Platform to $SetSupportedPlatformTo on $appname")) { 292 | $appobject = $app | ForEach-Object {Set-ItemProperty -Path ([string]$_.PsPath -replace 'MicrosoftDeploymentToolkit\\MDTProvider::',"") -Name SupportedPlatform -Value $code} 293 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform') 294 | Write-Output $appobject 295 | } 296 | } 297 | "GUIDFilter" { 298 | if($GUID -notmatch "{*}") { 299 | $GUID = ("{" + $GUID + "}") 300 | } 301 | $app = Get-MDTApplication -ShareName $ShareName -GUID $GUID 302 | $appname = $app.Name 303 | if ($PSCmdlet.ShouldProcess($ShareName,"Setting Supported Platform to $SetSupportedPlatformTo on $appname")) { 304 | $appobject = $app | ForEach-Object {Set-ItemProperty -Path ([string]$_.PsPath -replace 'MicrosoftDeploymentToolkit\\MDTProvider::',"") -Name SupportedPlatform -Value $code} 305 | $appobject.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.SupportedPlatform') 306 | Write-Output $appobject 307 | } 308 | } 309 | } 310 | } 311 | } 312 | 313 | Function Find-MDTApplicationContent { 314 | [cmdletbinding()] 315 | param( 316 | [Parameter(Mandatory=$true)] 317 | $ShareName, 318 | $String, 319 | [switch]$ParseScript 320 | 321 | ) 322 | BEGIN { 323 | $apps = Get-MDTApplication -ShareName $ShareName 324 | $filetypes = @(".bat",".cmd",".vbs",".wsf",".ps1",".psm1",".psd1") 325 | $sharepath = (Get-PSDrive -Name $ShareName).Root 326 | } 327 | PROCESS { 328 | if($ParseScript) { 329 | foreach ($app in $apps) { #goes through all apps in share 330 | if ($app.Source -notlike $null) { #makes sure app has files to search for 331 | $apppath = ($app.Source.ToString()).substring(1) 332 | $apppath = "$sharepath$apppath" 333 | if (Test-Path $apppath) { #makes sure apppath exists 334 | $appcontents = Get-ChildItem -Path $apppath #gets list of files in $apppath 335 | foreach ($item in $appcontents) { #goes through each item in $apppath 336 | $itemfound = $false 337 | $lineobj = @() 338 | foreach ($filetype in $filetypes) { 339 | if ($item -like "*$filetype*") { #selects only items with filetype defined in $filetypes 340 | $itemcontent = Get-Content -Path $item.FullName #gets content of item 341 | foreach ($line in $itemcontent) { #goes through each line in item content, 342 | if ($line -like $String) { #and outputs if string matches 343 | $itemfound = $true 344 | $line = $line.ReadCount.ToString() + ': ' + $line.Trim() #prepends the line number to the beginning of the found string 345 | $lineobj += $line 346 | } 347 | } 348 | if ($itemfound) { 349 | $app.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationContent.ParseScript') 350 | $app = $app | Add-Member NoteProperty Script($item) -PassThru| Add-Member NoteProperty LinesFound($lineobj) -PassThru 351 | Write-Output $app 352 | } 353 | } 354 | } 355 | } 356 | } 357 | } 358 | } 359 | } else { 360 | $app = Get-MDTApplication -ShareName $ShareName | Where-Object {$_.CommandLine -like "$String"} 361 | $app.PSObject.TypeNames.Insert(0,'Microsoft.BDD.PSSnapIn.MDTObject.MDTApplicationTools.ApplicationContent.InstallCmd') 362 | Write-Output $app 363 | 364 | } 365 | } 366 | } 367 | 368 | function Rename-MDTApplication { 369 | [cmdletbinding( 370 | SupportsShouldProcess=$true, 371 | ConfirmImpact="High" 372 | )] 373 | param( 374 | [Parameter(Mandatory=$true)] 375 | [Parameter(ParameterSetName='NameFilter')] 376 | [Parameter(ParameterSetName='GUIDFilter')] 377 | $ShareName, 378 | [Parameter(Mandatory=$true, 379 | ValueFromPipelineByPropertyName=$true, 380 | ParameterSetName='NameFilter')] 381 | $Name, 382 | [Parameter( 383 | Mandatory=$true, 384 | ValueFromPipelineByPropertyName=$true, 385 | ParameterSetName='GUIDFilter')] 386 | $GUID, 387 | [Parameter(Mandatory=$true)] 388 | [Parameter(ParameterSetName='NameFilter')] 389 | [Parameter(ParameterSetName='GUIDFilter')] 390 | $NewName, 391 | [Parameter(ParameterSetName='NameFilter')] 392 | [Parameter(ParameterSetName='GUIDFilter')] 393 | [switch]$RenameSource, 394 | [Parameter(ParameterSetName='NameFilter')] 395 | [Parameter(ParameterSetName='GUIDFilter')] 396 | [switch]$Force 397 | ) 398 | PROCESS { 399 | $prevappcheck = Get-MDTApplication -ShareName $ShareName -Name $NewName 400 | if(!$prevappcheck -or $Force) { 401 | switch ($PSCmdlet.ParameterSetName) { 402 | "NameFilter" { 403 | $app = Get-MDTApplication -ShareName $ShareName -Name $Name 404 | } 405 | "GUIDFilter" { 406 | if($GUID -notmatch "{*}") { 407 | $GUID = ("{" + $GUID + "}") 408 | } 409 | $app = Get-MDTApplication -ShareName $ShareName -GUID $GUID 410 | } 411 | } 412 | if($app -or $Force){ 413 | $appname = $app.Name #variable needed to display name in shouldprocess statements 414 | $apppath = ([string]$app.PsPath -split "::")[1] #path used for set-itemproperty statements 415 | if ($app.CommandLine -notlike "") { 416 | if ($app.Source -notlike "") { 417 | $apptype = "APPSOURCE" 418 | } else { 419 | $apptype = "APPNOSOURCE" 420 | } 421 | } else { 422 | $apptype = "APPBUNDLE" 423 | } 424 | if ($RenameSource -eq $false -or $apptype -eq "APPBUNDLE" -or $apptype -eq "APPNOSOURCE") { 425 | if ($PSCmdlet.ShouldProcess($ShareName,"Renaming $appname to $NewName")) { 426 | Set-ItemProperty -Path $apppath -Name ShortName -Value $NewName 427 | Set-ItemProperty -Path $apppath -Name Name -Value $NewName 428 | } 429 | } else { 430 | $mdtdriveroot = Get-PSDrive -Name $ShareName | Select-Object -ExpandProperty Root 431 | $origfullpath = $mdtdriveroot + $app.Source.TrimStart(".") 432 | $oldsourcename = $app.Source.split("\") | Select-Object -Last 1 433 | $newsourcepath = $app.Source.Replace($oldsourcename,$NewName) #path used when changing source path property 434 | if ($PSCmdlet.ShouldProcess($ShareName,"Renaming $appname to $NewName, and renaming source directory from $oldsourcename to $NewName")) { 435 | try { 436 | Rename-Item -Path $origfullpath -NewName $NewName -ErrorAction Stop 437 | Set-ItemProperty -Path $apppath -Name Source -Value $newsourcepath 438 | Set-ItemProperty -Path $apppath -Name WorkingDirectory -Value $newsourcepath 439 | Set-ItemProperty -Path $apppath -Name ShortName -Value $NewName 440 | Set-ItemProperty -Path $apppath -Name Name -Value $NewName 441 | } catch { 442 | Write-Error "issue renaming directory. no changes have been made." 443 | } 444 | } 445 | } 446 | } else { 447 | switch ($PSCmdlet.ParameterSetName) { 448 | "NameFilter" { 449 | Write-Error "no app with Name $Name exists" 450 | } 451 | "GUIDFilter" { 452 | if($GUID -notmatch "{*}") { 453 | $GUID = ("{" + $GUID + "}") 454 | } 455 | Write-Error "no app with GUID $GUID exists" 456 | } 457 | } 458 | } 459 | } else { 460 | Write-Error "An app with the name $NewName already exists" 461 | } 462 | } 463 | } -------------------------------------------------------------------------------- /en-US/MDTApplicationTools-help.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Find-MDTApplicationContent 6 | Find 7 | MDTApplicationContent 8 | Searches MDT shares for applications whose content contain specified text. 9 | 10 | 11 | 12 | The Find-MDTApplicationContent function retrieves MDT applications from the specified MDT share that contain the string specified. It can query either just the CommandLine attribute of the application, or it can also query the install scripts themselves if the ParseScript switch is specified. 13 | 14 | 15 | Find-MDTApplicationContent 16 | ShareName 17 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 18 | 19 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 20 | 21 | or 22 | 23 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 24 | 25 | 26 | Object 27 | Object 28 | 29 | 30 | 31 | String 32 | Specifies the string to search for in MDT applications. If typed explicitly (i.e. "setup.exe /s"), it will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like \ powershell.exe\ would return all the applications that have powershell.exe in their commandline or install script(depending on whether the ParseScript parameter was used). 33 | 34 | 35 | Object 36 | Object 37 | 38 | 39 | 40 | ParseScript 41 | IF NOT specified, the only part of the apps that are searched are the "CommandLine" attribute, which is the initial command that gets launched at install time to install the app(it can reference either an executable or an install script path). IF specified, the script will actually go through the applications working directory, and parse through any install scripts to see if they contain the specified string. It searches the following files: 42 | 43 | ".bat",".cmd",".vbs",".wsf",".ps1",".psm1",".psd1" 44 | 45 | 46 | SwitchParameter 47 | 48 | False 49 | 50 | 51 | 52 | ParseScript 53 | IF NOT specified, the only part of the apps that are searched are the "CommandLine" attribute, which is the initial command that gets launched at install time to install the app(it can reference either an executable or an install script path). IF specified, the script will actually go through the applications working directory, and parse through any install scripts to see if they contain the specified string. It searches the following files: 54 | 55 | ".bat",".cmd",".vbs",".wsf",".ps1",".psm1",".psd1" 56 | 57 | 58 | SwitchParameter 59 | SwitchParameter 60 | 61 | False 62 | 63 | ShareName 64 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 65 | 66 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 67 | 68 | or 69 | 70 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 71 | 72 | 73 | Object 74 | Object 75 | 76 | 77 | 78 | String 79 | Specifies the string to search for in MDT applications. If typed explicitly (i.e. "setup.exe /s"), it will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like \ powershell.exe\ would return all the applications that have powershell.exe in their commandline or install script(depending on whether the ParseScript parameter was used). 80 | 81 | 82 | Object 83 | Object 84 | 85 | 86 | 87 | 88 | None 89 | 90 | 91 | 92 | 93 | 94 | 95 | System.Object 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | Example 1 107 | PS C:\> Find-MDTApplicationContent -ShareName MDTProduction -string "setup.exe /s" 108 | This command searches the MDT share MDTProduction, and returns any applications where the "CommandLine" attribute matches "setup.exe /s" exactly. 109 | 110 | 111 | 112 | Example 2 113 | PS C:\> Find-MDTApplicationContent -ShareName MDTProduction -string *.bat* 114 | This command searches the MDT share MDTProduction, and returns any applications that call a .bat file in their "CommandLine" attribute 115 | 116 | 117 | 118 | Example 3 119 | PS C:\> Find-MDTApplicationContent -ShareName MDTProduction -string "C:\Program Files\*" -ParseScript 120 | This command searches the MDT share MDTProduction, and returns any applications that call a .bat file in their "CommandLine" attribute 121 | 122 | 123 | 124 | 125 | Online Version: 126 | https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Find-MDTApplicationContent.md 127 | 128 | 129 | 130 | 131 | Get-MDTApplication 132 | Get 133 | MDTApplication 134 | Gets one or more MDT applications 135 | 136 | 137 | 138 | The Get-MDTApplication function retrieves MDT applications from the specified MDT share. It can be used to either retrieve all the applications at once, or just by the applications Name or GUID of the wanted application. 139 | 140 | 141 | Get-MDTApplication 142 | GUID 143 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 144 | 145 | 146 | Object 147 | Object 148 | 149 | 150 | 151 | Location 152 | Specifies that the query be restricted to a folder located within the Applications folder. Specifying "Install\Broken" for example would restrict the search to the folder "Applications\Install\Broken" in the MDT share. 153 | 154 | 155 | Object 156 | Object 157 | 158 | 159 | 160 | ShareName 161 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 162 | 163 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 164 | 165 | or 166 | 167 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 168 | 169 | 170 | Object 171 | Object 172 | 173 | 174 | 175 | 176 | Get-MDTApplication 177 | Location 178 | Specifies that the query be restricted to a folder located within the Applications folder. Specifying "Install\Broken" for example would restrict the search to the folder "Applications\Install\Broken" in the MDT share. 179 | 180 | 181 | Object 182 | Object 183 | 184 | 185 | 186 | Name 187 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 188 | 189 | 190 | Object 191 | Object 192 | 193 | 194 | 195 | ShareName 196 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 197 | 198 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 199 | 200 | or 201 | 202 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 203 | 204 | 205 | Object 206 | Object 207 | 208 | 209 | 210 | 211 | 212 | GUID 213 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 214 | 215 | 216 | Object 217 | Object 218 | 219 | 220 | 221 | Location 222 | Specifies that the query be restricted to a folder located within the Applications folder. Specifying "Install\Broken" for example would restrict the search to the folder "Applications\Install\Broken" in the MDT share. 223 | 224 | 225 | Object 226 | Object 227 | 228 | 229 | 230 | Name 231 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 232 | 233 | 234 | Object 235 | Object 236 | 237 | 238 | 239 | ShareName 240 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 241 | 242 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 243 | 244 | or 245 | 246 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 247 | 248 | 249 | Object 250 | Object 251 | 252 | 253 | 254 | 255 | System.Object 256 | 257 | 258 | 259 | 260 | 261 | 262 | System.Object 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | Example 1: Get all applications 274 | PS C:\>Get-MDTApplication -ShareName MDTProduction 275 | This command returns all applications from the MDT share. 276 | 277 | 278 | 279 | Example 2: Get only applications in a certain directory 280 | PS C:\>Get-MDTApplication -ShareName MDTProduction -Location "APPBUNDLES" 281 | This command returns all applications from the MDT share that are located in a folder called "APPBUNDLES" (located under the Applications root folder). 282 | 283 | 284 | 285 | Example 3: Get application by name 286 | PS C:\>Get-MDTApplication -ShareName MDTProduction -Name "Install - Java 8 - x64" 287 | This command returns the application with the name "Install - Java 8 - x64" from the MDT share. 288 | 289 | 290 | 291 | Example 4: Use wildcards to search for applications 292 | PS C:\>Get-MDTApplication -ShareName MDTProduction -Name *java* 293 | This command returns any applications that have the word java somewhere in their name from the MDT share. 294 | 295 | 296 | 297 | Example 5: Get application by GUID 298 | PS C:\>Get-MDTApplication -ShareName MDTProduction -GUID "{4deefc41-71c2-4f59-bcf7-89fd4629a025}" 299 | This command returns the application with the GUID "4deefc41-71c2-4f59-bcf7-89fd4629a025" from the MDT share. 300 | 301 | 302 | 303 | 304 | Online Version: 305 | https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Get-MDTApplication.md 306 | 307 | 308 | 309 | 310 | Get-MDTApplicationDependency 311 | Get 312 | MDTApplicationDependency 313 | Gets the application dependencies of or more MDT applications 314 | 315 | 316 | 317 | The Get-MDTApplicationDependency function either returns all the applications that the application is dependent upon(applications that need to be installed before installing the queried application), or applications upon which the queried application is a dependency. It can go back either just one application, or can recurse the entire depth of the dependency tree. 318 | 319 | 320 | Get-MDTApplicationDependency 321 | DependencyType 322 | Specifies whether to return the parent dependencies of the queried application(applications that need to be installed before installing the queried application), or to return the child dependencies of the queried application(applications where the queried application needs to be installed first). Possible options are ReturnParent and ReturnChild. Default value is ReturnParent. 323 | 324 | 325 | ReturnParent 326 | ReturnChild 327 | 328 | Object 329 | Object 330 | 331 | ReturnParent 332 | 333 | GUID 334 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 335 | 336 | 337 | Object 338 | Object 339 | 340 | 341 | 342 | Recurse 343 | If specified recurses the dependency tree until it reaches the last dependency. If not, only finds dependencies that are one depth away. 344 | 345 | 346 | SwitchParameter 347 | 348 | False 349 | 350 | ShareName 351 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 352 | 353 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 354 | 355 | or 356 | 357 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 358 | 359 | 360 | Object 361 | Object 362 | 363 | 364 | 365 | 366 | Get-MDTApplicationDependency 367 | DependencyType 368 | Specifies whether to return the parent dependencies of the queried application(applications that need to be installed before installing the queried application), or to return the child dependencies of the queried application(applications where the queried application needs to be installed first). Possible options are ReturnParent and ReturnChild. Default value is ReturnParent. 369 | 370 | 371 | ReturnParent 372 | ReturnChild 373 | 374 | Object 375 | Object 376 | 377 | ReturnParent 378 | 379 | Name 380 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 381 | 382 | 383 | Object 384 | Object 385 | 386 | 387 | 388 | Recurse 389 | If specified recurses the dependency tree until it reaches the last dependency. If not, only finds dependencies that are one depth away. 390 | 391 | 392 | SwitchParameter 393 | 394 | False 395 | 396 | ShareName 397 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 398 | 399 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 400 | 401 | or 402 | 403 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 404 | 405 | 406 | Object 407 | Object 408 | 409 | 410 | 411 | 412 | 413 | DependencyType 414 | Specifies whether to return the parent dependencies of the queried application(applications that need to be installed before installing the queried application), or to return the child dependencies of the queried application(applications where the queried application needs to be installed first). Possible options are ReturnParent and ReturnChild. Default value is ReturnParent. 415 | 416 | 417 | Object 418 | Object 419 | 420 | ReturnParent 421 | 422 | GUID 423 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 424 | 425 | 426 | Object 427 | Object 428 | 429 | 430 | 431 | Name 432 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 433 | 434 | 435 | Object 436 | Object 437 | 438 | 439 | 440 | Recurse 441 | If specified recurses the dependency tree until it reaches the last dependency. If not, only finds dependencies that are one depth away. 442 | 443 | 444 | SwitchParameter 445 | SwitchParameter 446 | 447 | False 448 | 449 | ShareName 450 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 451 | 452 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 453 | 454 | or 455 | 456 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 457 | 458 | 459 | Object 460 | Object 461 | 462 | 463 | 464 | 465 | System.Object 466 | 467 | 468 | 469 | 470 | 471 | 472 | System.Object 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | Example 1: Get any direct parent dependencies of an app 484 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" 485 | Returns only applications that will be installed directly before the Java JDK is installed. 486 | 487 | 488 | 489 | Example 2: Get any direct child dependencies of an app 490 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" -DependencyType ReturnChild 491 | Returns only applications that will install the Java JDK directly after they themselves are installed 492 | 493 | 494 | 495 | Example 3: Get **all** parent dependencies of an app 496 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" -Recurse 497 | Returns all applications that need to be installed before the Java JDK is installed. 498 | 499 | 500 | 501 | Example 4: Get **all** child dependencies of an app 502 | PS C:\> Get-MDTApplicationDependency -ShareName MDTProduction -Name "Install - Java Development Kit - x64" -Recurse -DependencyType ReturnChild 503 | Returns all applications that will be installed after the Java JDK is installed 504 | 505 | 506 | 507 | 508 | Online Version: 509 | https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Get-MDTApplicationDependency.md 510 | 511 | 512 | 513 | 514 | Get-MDTApplicationSupportedPlatform 515 | Get 516 | MDTApplicationSupportedPlatform 517 | Gets the SupportedPlatform attribute of or more MDT applications 518 | 519 | 520 | 521 | The Get-MDTApplicationSupportedPlatform function can either return the SupportedPlatform attribute of a queried application(via the name or GUID) parameter, return it for all applications, or return just applications that have it set(or not). 522 | 523 | 524 | Get-MDTApplicationSupportedPlatform 525 | GUID 526 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 527 | 528 | 529 | Object 530 | Object 531 | 532 | 533 | 534 | ShareName 535 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 536 | 537 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 538 | 539 | or 540 | 541 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 542 | 543 | 544 | Object 545 | Object 546 | 547 | 548 | 549 | SupportedPlatformSet 550 | Specifies in the query whether to return just Applications that have it set(Yes), just Applications that do NOT have it set(No), or to return Applications that both states(All). 551 | 552 | 553 | Yes 554 | No 555 | All 556 | 557 | Object 558 | Object 559 | 560 | All 561 | 562 | 563 | Get-MDTApplicationSupportedPlatform 564 | Name 565 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 566 | 567 | 568 | Object 569 | Object 570 | 571 | 572 | 573 | ShareName 574 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 575 | 576 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 577 | 578 | or 579 | 580 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 581 | 582 | 583 | Object 584 | Object 585 | 586 | 587 | 588 | SupportedPlatformSet 589 | Specifies in the query whether to return just Applications that have it set(Yes), just Applications that do NOT have it set(No), or to return Applications that both states(All). 590 | 591 | 592 | Yes 593 | No 594 | All 595 | 596 | Object 597 | Object 598 | 599 | All 600 | 601 | 602 | 603 | GUID 604 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 605 | 606 | 607 | Object 608 | Object 609 | 610 | 611 | 612 | Name 613 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 614 | 615 | 616 | Object 617 | Object 618 | 619 | 620 | 621 | ShareName 622 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 623 | 624 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 625 | 626 | or 627 | 628 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 629 | 630 | 631 | Object 632 | Object 633 | 634 | 635 | 636 | SupportedPlatformSet 637 | Specifies in the query whether to return just Applications that have it set(Yes), just Applications that do NOT have it set(No), or to return Applications that both states(All). 638 | 639 | 640 | Object 641 | Object 642 | 643 | All 644 | 645 | 646 | System.Object 647 | 648 | 649 | 650 | 651 | 652 | 653 | System.Object 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | Example 1: Get all applications where the SupportedPlatform attribute is set(to anything) 665 | PS C:\> Get-MDTApplicationSupportedPlatform -ShareName TESTSHARE -SupportedPlatformSet Yes 666 | Returns all applications where SupportedPlatform is set. 667 | 668 | 669 | 670 | Example 2: Get all applications where the SupportedPlatform attribute is NOT set. 671 | PS C:\> Get-MDTApplicationSupportedPlatform -ShareName TESTSHARE -SupportedPlatformSet No 672 | Returns all applications where SupportedPlatform is NOT set. 673 | 674 | 675 | 676 | Example 3: Get SupportedPlatform attribute of specific application. 677 | PS C:\> Get-MDTApplicationSupportedPlatform -ShareName TESTSHARE -Name "Install - Google Chrome -x64" -SupportedPlatformSet All 678 | Returns the queried application along with it's SupportedPlatform attribute 679 | 680 | 681 | 682 | 683 | Online Version: 684 | https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Get-MDTApplicationSupportedPlatform.md 685 | 686 | 687 | 688 | 689 | Get-MDTDrive 690 | Get 691 | MDTDrive 692 | {{Fill in the Synopsis}} 693 | 694 | 695 | 696 | {{Fill in the Description}} 697 | 698 | 699 | Get-MDTDrive 700 | Name 701 | {{Fill Name Description}} 702 | 703 | 704 | Object 705 | Object 706 | 707 | 708 | 709 | 710 | 711 | Name 712 | {{Fill Name Description}} 713 | 714 | 715 | Object 716 | Object 717 | 718 | 719 | 720 | 721 | None 722 | 723 | 724 | 725 | 726 | 727 | 728 | System.Object 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | Example 1 740 | PS C:\> {{ Add example code here }} 741 | {{ Add example description here }} 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | Import-MDTModule 750 | Import 751 | MDTModule 752 | {{Fill in the Synopsis}} 753 | 754 | 755 | 756 | {{Fill in the Description}} 757 | 758 | 759 | Import-MDTModule 760 | 761 | 762 | 763 | None 764 | 765 | 766 | 767 | 768 | 769 | 770 | System.Object 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | Example 1 782 | PS C:\> {{ Add example code here }} 783 | {{ Add example description here }} 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | Rename-MDTApplication 792 | Rename 793 | MDTApplication 794 | Renames an MDT application. 795 | 796 | 797 | 798 | The Rename-MDTApplication function renames an MDT application, optionally also renaming the source directory if the applications source files have been imported into MDT. Applications to be renamed can be specified by either their Name or their GUID. 799 | 800 | 801 | Rename-MDTApplication 802 | Confirm 803 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 804 | 805 | 806 | SwitchParameter 807 | 808 | $true 809 | 810 | Force 811 | If specified, disables the checks to verify that 1: the app to be renamed exists and 2: that new name isn't already in use. Use carefully. 812 | 813 | 814 | SwitchParameter 815 | 816 | $false 817 | 818 | GUID 819 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 820 | 821 | 822 | Object 823 | Object 824 | 825 | 826 | 827 | NewName 828 | Specifies what the new name of the application will be once renamed. Rename-MDTApplication will check the existing applications to make sure there are no duplicates before making any changes. 829 | 830 | 831 | Object 832 | Object 833 | 834 | 835 | 836 | RenameSource 837 | If specified, will also rename the actual application source folder inside of the MDT share. This parameter will only process if the application has it's source files located within the MDT share(the three MDT app types are "apps with source files", "apps with sources on network or elsewhere", and "app bundles". this parameter only processes the first of these three). 838 | 839 | 840 | SwitchParameter 841 | 842 | $false 843 | 844 | ShareName 845 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 846 | 847 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 848 | 849 | or 850 | 851 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 852 | 853 | 854 | Object 855 | Object 856 | 857 | 858 | 859 | WhatIf 860 | If specified, will output what changes the command will make without making them. 861 | 862 | 863 | SwitchParameter 864 | 865 | False 866 | 867 | 868 | Rename-MDTApplication 869 | Confirm 870 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 871 | 872 | 873 | SwitchParameter 874 | 875 | $true 876 | 877 | Force 878 | If specified, disables the checks to verify that 1: the app to be renamed exists and 2: that new name isn't already in use. Use carefully. 879 | 880 | 881 | SwitchParameter 882 | 883 | $false 884 | 885 | Name 886 | Specifies the Name of an application to query the MDT share for. Alternate to GUID Parameter. 887 | 888 | 889 | Object 890 | Object 891 | 892 | 893 | 894 | NewName 895 | Specifies what the new name of the application will be once renamed. Rename-MDTApplication will check the existing applications to make sure there are no duplicates before making any changes. 896 | 897 | 898 | Object 899 | Object 900 | 901 | 902 | 903 | RenameSource 904 | If specified, will also rename the actual application source folder inside of the MDT share. This parameter will only process if the application has it's source files located within the MDT share(the three MDT app types are "apps with source files", "apps with sources on network or elsewhere", and "app bundles". this parameter only processes the first of these three). 905 | 906 | 907 | SwitchParameter 908 | 909 | $false 910 | 911 | ShareName 912 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 913 | 914 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 915 | 916 | or 917 | 918 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 919 | 920 | 921 | Object 922 | Object 923 | 924 | 925 | 926 | WhatIf 927 | If specified, will output what changes the command will make without making them. 928 | 929 | 930 | SwitchParameter 931 | 932 | False 933 | 934 | 935 | 936 | Confirm 937 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 938 | 939 | 940 | SwitchParameter 941 | SwitchParameter 942 | 943 | $true 944 | 945 | Force 946 | If specified, disables the checks to verify that 1: the app to be renamed exists and 2: that new name isn't already in use. Use carefully. 947 | 948 | 949 | SwitchParameter 950 | SwitchParameter 951 | 952 | $false 953 | 954 | GUID 955 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 956 | 957 | 958 | Object 959 | Object 960 | 961 | 962 | 963 | Name 964 | Specifies the Name of an application to query the MDT share for. Alternate to GUID Parameter. 965 | 966 | 967 | Object 968 | Object 969 | 970 | 971 | 972 | NewName 973 | Specifies what the new name of the application will be once renamed. Rename-MDTApplication will check the existing applications to make sure there are no duplicates before making any changes. 974 | 975 | 976 | Object 977 | Object 978 | 979 | 980 | 981 | RenameSource 982 | If specified, will also rename the actual application source folder inside of the MDT share. This parameter will only process if the application has it's source files located within the MDT share(the three MDT app types are "apps with source files", "apps with sources on network or elsewhere", and "app bundles". this parameter only processes the first of these three). 983 | 984 | 985 | SwitchParameter 986 | SwitchParameter 987 | 988 | $false 989 | 990 | ShareName 991 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 992 | 993 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 994 | 995 | or 996 | 997 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 998 | 999 | 1000 | Object 1001 | Object 1002 | 1003 | 1004 | 1005 | WhatIf 1006 | If specified, will output what changes the command will make without making them. 1007 | 1008 | 1009 | SwitchParameter 1010 | SwitchParameter 1011 | 1012 | False 1013 | 1014 | 1015 | System.Object 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | System.Object 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | Example 1: Rename an application 1034 | PS C:\> Rename-MDTApplication -ShareName MDTProduction -Name "APP1" -NewName "APP2" 1035 | Renames APP1 to APP2(changes the "Name" and "ShortName" attributes) 1036 | 1037 | 1038 | 1039 | Example 2: Rename an application, also renaming it's source directory 1040 | PS C:\> Rename-MDTApplication -ShareName MDTProduction -Name "APP1" -NewName "APP2" -RenameSource 1041 | Renames APP1 to APP2, also changing the source directory name from APP1 to APP2(changes the "Name", "ShortName", "Source", and "WorkingDirectory" attributes, also renaming the source directory itself) 1042 | 1043 | 1044 | 1045 | Example 3: Rename an application, also renaming it's source directory 1046 | PS C:\> Rename-MDTApplication -ShareName MDTProduction -Name "APP1" -NewName "APP2" -Force 1047 | Renames APP1 to APP2, with the Force parameter disabling the check to see if the application to be renamed exists in the MDT share, and also the check to see if the New Name is already in use by another MDT application. Use with caution. 1048 | 1049 | 1050 | 1051 | 1052 | Online Version: 1053 | https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Rename-MDTApplication.md 1054 | 1055 | 1056 | 1057 | 1058 | Set-MDTApplicationSupportedPlatform 1059 | Set 1060 | MDTApplicationSupportedPlatform 1061 | Sets the SupportedPlatform attribute of or more MDT applications 1062 | 1063 | 1064 | 1065 | The Set-MDTApplicationSupportedPlatform function sets the SupportedPlatform attribute on one or more MDT applications. It can either set the attribute to Null, or can set it to one of the predefined OS's. The OS restriction types are a bit more granular when setting this attribute via MDT's GUI, so due to the complexity behind scripting each one, broader "catch-all" types are used. At the moment this tool also disregards any previous settings of the attribute, so any previous settings will be overwritten with the new data specified by the command. 1066 | 1067 | 1068 | Set-MDTApplicationSupportedPlatform 1069 | Confirm 1070 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 1071 | 1072 | 1073 | SwitchParameter 1074 | 1075 | $true 1076 | 1077 | GUID 1078 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 1079 | 1080 | 1081 | Object 1082 | Object 1083 | 1084 | 1085 | 1086 | SetSupportedPlatformTo 1087 | Specifies what OS restriction to apply to the application(or to remove the restriction by selecting Null). The OS restriction types are a bit more granular when setting this attribute via MDT's GUI, so due to the complexity behind scripting each one, broader "catch-all" types are used. At the moment this tool also disregards any previous settings of the attribute, so any previous settings will be overwritten with the new data specified here. 1088 | 1089 | 1090 | Null 1091 | Windows7Only 1092 | Windows8Only 1093 | Windows8.1Only 1094 | Windows10Only 1095 | 1096 | Object 1097 | Object 1098 | 1099 | 1100 | 1101 | ShareName 1102 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 1103 | 1104 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 1105 | 1106 | or 1107 | 1108 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 1109 | 1110 | 1111 | Object 1112 | Object 1113 | 1114 | 1115 | 1116 | WhatIf 1117 | If specified, will output what changes the command will make without making them. 1118 | 1119 | 1120 | SwitchParameter 1121 | 1122 | False 1123 | 1124 | 1125 | Set-MDTApplicationSupportedPlatform 1126 | Confirm 1127 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 1128 | 1129 | 1130 | SwitchParameter 1131 | 1132 | $true 1133 | 1134 | Name 1135 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 1136 | 1137 | 1138 | Object 1139 | Object 1140 | 1141 | 1142 | 1143 | SetSupportedPlatformTo 1144 | Specifies what OS restriction to apply to the application(or to remove the restriction by selecting Null). The OS restriction types are a bit more granular when setting this attribute via MDT's GUI, so due to the complexity behind scripting each one, broader "catch-all" types are used. At the moment this tool also disregards any previous settings of the attribute, so any previous settings will be overwritten with the new data specified here. 1145 | 1146 | 1147 | Null 1148 | Windows7Only 1149 | Windows8Only 1150 | Windows8.1Only 1151 | Windows10Only 1152 | 1153 | Object 1154 | Object 1155 | 1156 | 1157 | 1158 | ShareName 1159 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 1160 | 1161 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 1162 | 1163 | or 1164 | 1165 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 1166 | 1167 | 1168 | Object 1169 | Object 1170 | 1171 | 1172 | 1173 | WhatIf 1174 | If specified, will output what changes the command will make without making them. 1175 | 1176 | 1177 | SwitchParameter 1178 | 1179 | False 1180 | 1181 | 1182 | 1183 | Confirm 1184 | The confirm preference. If left alone, will prompt you before modifying each application. If set to $false, it just goes through. 1185 | 1186 | 1187 | SwitchParameter 1188 | SwitchParameter 1189 | 1190 | $true 1191 | 1192 | GUID 1193 | Specifies the GUID of an application to query the MDT share for. Alternate to Name Parameter. 1194 | 1195 | 1196 | Object 1197 | Object 1198 | 1199 | 1200 | 1201 | Name 1202 | Specifies the name of an application to search the MDT share for. If typed explicitly (i.e. "Install - Adobe Flash Player - x64"), will only return applications that have that exact name. The parameter also supports wildcards though, so typing something like "\ adobe\ " would return all the applications that have adobe in their name. 1203 | 1204 | 1205 | Object 1206 | Object 1207 | 1208 | 1209 | 1210 | SetSupportedPlatformTo 1211 | Specifies what OS restriction to apply to the application(or to remove the restriction by selecting Null). The OS restriction types are a bit more granular when setting this attribute via MDT's GUI, so due to the complexity behind scripting each one, broader "catch-all" types are used. At the moment this tool also disregards any previous settings of the attribute, so any previous settings will be overwritten with the new data specified here. 1212 | 1213 | 1214 | Object 1215 | Object 1216 | 1217 | 1218 | 1219 | ShareName 1220 | Specifies the name of the MDT share to query. In order to query by name, the MDT share must be mounted using either New-PSDrive or Set-MDTDrive. Here are some examples that should get you up and running: 1221 | 1222 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 1223 | 1224 | or 1225 | 1226 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 1227 | 1228 | 1229 | Object 1230 | Object 1231 | 1232 | 1233 | 1234 | WhatIf 1235 | If specified, will output what changes the command will make without making them. 1236 | 1237 | 1238 | SwitchParameter 1239 | SwitchParameter 1240 | 1241 | False 1242 | 1243 | 1244 | System.Object 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | System.Object 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | Example 1: Remove OS restriction for ALL applications in MDT Share 1263 | PS C:\> Set-MDTApplicationSupportedPlatform -ShareName MDTProduction -SetSupportedPlatformTo Null 1264 | Removes the OS restriction for ALL applications in MDTProduction (add a -confirm:$false on the end to remove prompts for each application) 1265 | 1266 | 1267 | 1268 | Example 2: Set ALL applications in share to Windows 7 1269 | PS C:\> Set-MDTApplicationSupportedPlatform -ShareName MDTProduction -SetSupportedPlatformTo Windows7Only 1270 | Set OS restriction for ALL applications in MDTProduction to Windows 7(add a -confirm:$false on the end to remove prompts for each application) 1271 | 1272 | 1273 | 1274 | Example 3: Set one application to windows 10 1275 | PS C:\> Set-MDTApplicationSupportedPlatform -ShareName MDTProduction -Name "Install - Java Runtime Environment -x86" -SetSupportedPlatformTo Windows10Only 1276 | Set OS restriction for "Install - Java Runtime Environment -x86" in MDTProduction to Windows 10 1277 | 1278 | 1279 | 1280 | 1281 | Online Version: 1282 | https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Set-MDTApplicationSupportedPlatform.md 1283 | 1284 | 1285 | 1286 | 1287 | Set-MDTDrive 1288 | Set 1289 | MDTDrive 1290 | Creates an MDT drive. 1291 | 1292 | 1293 | 1294 | The Set-MDTDrive function creates an MDT drive using the MDTProvider for powershell. This function is actually just a wrapper for New-PSDrive with the MDTProvider. For example this: 1295 | 1296 | `PS C:>Set-MDTDrive -Name MDTProduction -Path "\FILESERVER\MDTProduction$"` 1297 | 1298 | is actually the same command as this: 1299 | 1300 | `PS C:>New-PSDrive -Name MDTProduction -PSProvider MDTProvider -Root "\FILESERVER\MDTProduction$" -NetworkPath "\FILESERVER\MDTProduction$" -Scope Global` 1301 | 1302 | 1303 | Set-MDTDrive 1304 | Name 1305 | Specifies what name you would like to give to the drive you want to create. This is the share name you'll reference later on when querying the share. 1306 | 1307 | 1308 | Object 1309 | Object 1310 | 1311 | 1312 | 1313 | Path 1314 | {{Fill Path Description}} 1315 | 1316 | 1317 | Object 1318 | Object 1319 | 1320 | 1321 | 1322 | Confirm 1323 | The confirm preference. If left alone, will just let the command run as normal. If $true is specified, will prompt you before creating the drive. 1324 | 1325 | 1326 | SwitchParameter 1327 | 1328 | False 1329 | 1330 | Force 1331 | If specified, will create MDT drive even if one with same name already exists(in case one wants to create a drive of the same name with a different path) 1332 | 1333 | 1334 | SwitchParameter 1335 | 1336 | False 1337 | 1338 | WhatIf 1339 | If specified, will output what changes the command will make without making them. 1340 | 1341 | 1342 | SwitchParameter 1343 | 1344 | False 1345 | 1346 | 1347 | 1348 | Confirm 1349 | The confirm preference. If left alone, will just let the command run as normal. If $true is specified, will prompt you before creating the drive. 1350 | 1351 | 1352 | SwitchParameter 1353 | SwitchParameter 1354 | 1355 | False 1356 | 1357 | Force 1358 | If specified, will create MDT drive even if one with same name already exists(in case one wants to create a drive of the same name with a different path) 1359 | 1360 | 1361 | SwitchParameter 1362 | SwitchParameter 1363 | 1364 | False 1365 | 1366 | Name 1367 | Specifies what name you would like to give to the drive you want to create. This is the share name you'll reference later on when querying the share. 1368 | 1369 | 1370 | Object 1371 | Object 1372 | 1373 | 1374 | 1375 | Path 1376 | {{Fill Path Description}} 1377 | 1378 | 1379 | Object 1380 | Object 1381 | 1382 | 1383 | 1384 | WhatIf 1385 | If specified, will output what changes the command will make without making them. 1386 | 1387 | 1388 | SwitchParameter 1389 | SwitchParameter 1390 | 1391 | False 1392 | 1393 | 1394 | None 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | System.Object 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | Example 1: Create an MDT drive 1413 | PS C:\> Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$" 1414 | Creates an MDT Drive with a name of `MDTProduction` and a path of `"\FILESERVER\MDTProduction$"` 1415 | 1416 | 1417 | 1418 | Example 2: Create an MDT drive, overwriting previous drives 1419 | PS C:\> Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$" -Force 1420 | Creates an MDT Drive with a name of `MDTProduction` and a path of `"\FILESERVER\MDTProduction$"`, overwriting any previous drives with the name `MDTProduction`. 1421 | 1422 | 1423 | 1424 | Example 3: Shows what will happen if the command is run 1425 | PS C:\> Set-MDTDrive -Name MDTProduction -Path "\\FILESERVER\MDTProduction$" -WhatIf 1426 | Shows what will happen if you try to create an MDT Drive with a name of `MDTProduction` and a path of `"\FILESERVER\MDTProduction$"` 1427 | 1428 | 1429 | 1430 | 1431 | Online Version: 1432 | https://github.com/JohnForet/MDTApplicationTools/blob/master/docs/Set-MDTDrive.md 1433 | 1434 | 1435 | 1436 | 1437 | --------------------------------------------------------------------------------