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-PendingWindowsUpdate { | |
[CmdletBinding()] | |
param( | |
[Parameter(Position = 0, ValueFromPipeline = $true)] | |
[string[]]$ComputerName = $env:COMPUTERNAME) | |
Process { | |
# Use this scriptblock for both remote and local execution | |
$unifiedScriptBlock = [scriptblock]{ | |
param([string]$computer) | |
$ErrorActionPreference = $using:ErrorActionPreference; |
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 Install-WindowsUpdate { | |
[CmdletBinding(SupportsShouldProcess = $true)] | |
param( | |
[Parameter(Position = 0, Mandatory=$false, ValueFromPipeline = $true, ParameterSetName="computer")] | |
[string[]]$ComputerName = $env:COMPUTERNAME, | |
[Parameter(Position = 0, Mandatory=$true, ValueFromPipeline = $true, ParameterSetName="updates")] | |
[PSCustomObject[]]$PendingUpdates) | |
Process { |
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 Set-FileSystemItem { | |
<# | |
.SYNOPSIS | |
The Set-FileSystemItem command is the easiest way to create new, empty files. It is also used to change the timestamps (i.e., dates and times of the most recent access and modification) on existing files. | |
.DESCRIPTION | |
The Set-FileSystemItem command is used to update the access date and / or modification date of a file. In its default usage, it is the equivalent of creating or opening a file and saving it without any change to the file contents. Touch eliminates the unnecessary steps of opening the file, saving the file, and closing the file again. Instead it simply updates the dates associated with the file or directory. An updated access or modification date can be important for a variety of other programs such as backup utilities. Typically these types of programs are only concerned with files which have been created or modified after the program was last run. Set-FileSystemItem can also be useful for quickly creating files for programs or scripts that require a f |
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
<# | |
.SYNOPSIS | |
The New-PSModule command creates a convention based folder structure to develop a new powershell module. In addition the command automatically creates a module manifest file (.psd1). | |
.DESCRIPTION | |
The New-PSModule command creates a convention based folder structure to develop a new powershell module. The folder structure contains a folder for exported functions (public) and a folder for internal functions (private). Furthermore the structure contains a folder for test-scripts (Tests) and a folder with handy scripts to analyze and publish the created module. | |
In addition the command automatically creates a module manifest file (.psd1). The manifest file will be filled with the given parameters. The parameters of this command do only cover the bare minimum requirements of the manifest file. The file must be changed to complete all metadata. |
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 Update-PSModule { | |
<# | |
.SYNOPSIS | |
Contrary to Update-Module command this command removes all previous versions of the module automatically. | |
.DESCRIPTION | |
The Update-PSModule command tries to find the current version of the given module. If there is a new version of the module | |
available the command removes all previous versions of the module and installs the new version. When the newest version of | |
the module is already installed the command does nothing unless the Force parameter is present. In case the Force parameter | |
is present the module will always be reinstalled with the newest available version. |
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 Robot { | |
$overallIndex = 0; | |
$cx = $Host.UI.RawUI.CursorPosition.X; | |
$cy = $Host.UI.RawUI.CursorPosition.Y; | |
$left = 0; | |
$right = $Host.UI.RawUI.BufferSize.Width; | |
$sIdx = 0; | |
$uIdx = 0; | |
$stg = "walk"; |
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
#requires -version 5 | |
Set-StrictMode -Version Latest | |
Function Read-Input { | |
[Diagnostics.CodeAnalysis.SuppressMessage("PSAvoidUsingWriteHost", "", Justification = "This is an interface cmdlet that should be seen in its host.")] | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true, Position=1)] | |
[string]$Message, | |
[Parameter(Mandatory=$false, Position=2)] |
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 Add-EnvironmentPath { | |
<# | |
.SYNOPSIS | |
Adds a path to the PATH environment variable at give scope. | |
.DESCRIPTION | |
Adds a Path to the PATH environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine. | |
In addition to that the command sorts the paths and removes duplicates. | |
.PARAMETER Path |
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
#requires -version 5 | |
Set-StrictMode -Version Latest | |
Function Invoke-ScheduledCommand { | |
[Diagnostics.CodeAnalysis.SuppressMessage("PSUseDeclaredVarsMoreThanAssignments", "", Justification = "This re-establishes the global environment preferences. They can be used all over child scripts.")] | |
[OutputType("ScheduledCommandResult[]")] | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=0)] | |
[String]$TaskName, |
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
#requires -version 5 | |
Set-StrictMode -Version Latest | |
Function Add-StartupCommand { | |
[OutputType("ScheduledCommand")] | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true,Position=0)] | |
[String]$TaskName, | |
[Parameter(Mandatory=$true,Position=1)] |
OlderNewer