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
function Get-WindowsFeatures() { | |
[CmdletBinding()] | |
param() | |
$winFeatures = @(); | |
$tempFile = Join-Path $env:temp "__winFeatures.log"; | |
& dism.exe /online /get-features /format:table | out-file $tempFile -Force; | |
$discoveredFeatures = (Import-CSV -Delim '|' -Path $tempFile -Header Name,state | Where-Object {$_.State -eq "Enabled "}) | Select 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
function Prompt-YesNo($message) { | |
$noAnswerYet = $true; | |
while($noAnswerYet) { | |
try { | |
$messagePrompt = $message + "? [Y]es or [N]o"; | |
$answer = Read-Host -Prompt $messagePrompt; |
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
function Copy-Directory($sourceDir, $destinationDir) { | |
robocopy $sourceDir $destinationDir /S /E /Z /XA:HS /XD .* /W:5 /NFL /NDL /NJH /NJS /NC /NS /NP | Out-Null; | |
} |
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
function Synchronize-Directory($sourceDir, $destinationDir) { | |
robocopy $sourceDir $destinationDir /MIR /FFT /Z /XA:H /W:5 /NFL /NDL /NJH /NJS /NC /NS /NP | Out-Null; | |
} |
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
function Get-SystemVersion() { | |
return (Get-WmiObject -Class Win32_OperatingSystem).Caption + " [" + [system.environment]::OSVersion.Version.ToString() + "]"; | |
} |
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
function Get-ComputerName() { | |
return [system.environment]::MachineName; | |
} |
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
function Create-Directory($dirPath) { | |
if(!(Test-Path -Path $dirPath -PathType Container)) { | |
New-Item -Path $dirPath -ItemType directory -Force | Out-Null; | |
} | |
} |
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
function Delete-Directory($dirPath) { | |
if(Test-Path -Path $dirPath -PathType Container) { | |
Remove-Item -Path $dirPath -Recurse; | |
} | |
} |
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
function Test-Administrator | |
{ | |
<# | |
.SYNOPSIS | |
Returns True is the current user is an administrator | |
.DESCRIPTION | |
Returns True is the current user is an administrator | |
.EXAMPLE | |
if(Test-Administrator) { Action } | |
#> |
OlderNewer