Public/Import/Import-GroupISETheme.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function Import-GroupISETheme {
<#
    .Synopsis
     This is a function that Imports themes based on them being in ps1xml files stored in a directory that you give it
  .DESCRIPTION
     This is used internally by Add-ISETheme (so should be a Private Function) to Import ISE Theme files into the ISE
  .EXAMPLE
     Import-GroupISETheme -Directory C:\ISEThemes\
#>


    [cmdletbinding()]
    Param (
        [Parameter(Mandatory=$True)] [ValidateNotNullOrEmpty()]
        [string] $Directory
    )
    If (!(Test-Path 'HKCU:\Software\Microsoft\PowerShell\3\Hosts\PowerShellISE\ColorThemes')) {
            New-Item -Path 'HKCU:\Software\Microsoft\PowerShell\3\Hosts\PowerShellISE' -Name ColorThemes â€“Force | out-null
        }
    Get-ChildItem $Directory -Filter *.ps1xml -Recurse | Select-Object -ExpandProperty fullname | Import-ISEThemeFile     

}