This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$XMLFile = Get-Content $TemplateUnattendFile -Raw | |
$XmlFileOutput = $XMLFile.Replace('unattendAdministratorHere',$LocalAdministrator).Replace('unattendPasswordHere',$LocalAdministratorPassword) | |
if (-not (Test-Path (Split-Path $OutputUnattendFile -Parent))) { | |
$null = New-Item (Split-Path $OutputUnattendFile -Parent) -ItemType Directory | |
} | |
$XmlFileOutput | Out-File $OutputUnattendFile -Force utf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding(DefaultParameterSetName='Directory')] | |
Param( | |
[Parameter(Mandatory=$false, | |
ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] | |
[Parameter(ParameterSetName='Directory')] | |
[ValidateScript({Test-Path $_ -PathType Container })] | |
[System.String[]] | |
$Path, | |
[Parameter(Mandatory=$false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin { | |
Set-Variable Fonts -Value 0x14 -Option ReadOnly | |
$fontRegistryPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" | |
$shell = New-Object -ComObject Shell.Application | |
$folder = $shell.NameSpace($Fonts) | |
$objfontFolder = $folder.self.Path | |
#$copyOptions = 20 | |
$copyFlag = [string]::Format("{0:x}",4+16) | |
$copyFlag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process { | |
switch ($PsCmdlet.ParameterSetName) { | |
"Directory" { | |
ForEach ($fontsFolder in $Path){ | |
$fontFiles = Get-ChildItem -Path $fontsFolder -File -Recurse -Include @("*.fon", "*.fnt", "*.ttf","*.ttc", "*.otf", "*.mmm", "*.pbf", "*.pfm") | |
} | |
} | |
"File" { | |
$fontFiles = Get-ChildItem -Path $FontFile -Include @("*.fon", "*.fnt", "*.ttf","*.ttc", "*.otf", "*.mmm", "*.pbf", "*.pfm") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Drawing | |
$objFontCollection = New-Object System.Drawing.Text.PrivateFontCollection | |
$objFontCollection.AddFontFile($item.FullName) | |
$FontName = $objFontCollection.Families.Name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$folder.CopyHere($item.FullName, $copyFlag) | |
$regTest = Get-ItemProperty -Path $fontRegistryPath -Name "*$FontName*" -ErrorAction SilentlyContinue | |
if (-not ($regTest)) { | |
New-ItemProperty -Name $FontName -Path $fontRegistryPath -PropertyType string -Value $item.Name | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$URLs = @('https://download.microsoft.com/download/C/7/A/C7AAD914-A8A6-4904-88A1-29E657445D03/LAPS.x64.msi','https://download.microsoft.com/download/C/7/A/C7AAD914-A8A6-4904-88A1-29E657445D03/LAPS.x86.msi') | |
$Date = Get-Date -Format yyyyMMdd_hhmm | |
$TempFolder = "d:\Temp_$Date" | |
New-Item -Path $TempFolder -ItemType Directory -Force | |
$URLs | foreach-object { | |
$fileName = Split-Path $_ -Leaf | |
$DestinationPath = Join-Path $TempFolder -ChildPath $fileName | |
Invoke-WebRequest -Uri $_ -OutFile $DestinationPath | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Share_GPOInstalls_RGroupProps = @{ | |
Name = 'GPOInstalls_R' | |
SamAccountName = 'GPOInstalls_R' | |
Description = 'Members allowed to read from Share GPOInstalls' | |
DisplayName = 'GPOInstalls_R' | |
GroupCategory = 'Security' | |
GroupScope= 'Universal' | |
Path = 'OU=AD,OU=Security Groups,DC=contoso,DC=com' | |
} | |
New-ADGroup @Share_GPOInstalls_RGroupProps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module AdmPwd.PS | |
Update-AdmPwdADSchema |
OlderNewer