Skip to content

Commit

Permalink
v1.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Aug 9, 2023
1 parent f0280ce commit d0d15bf
Show file tree
Hide file tree
Showing 25 changed files with 784 additions and 663 deletions.
145 changes: 105 additions & 40 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,111 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${relativeFile}: the current opened file relative to workspaceRoot
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",

// Start PowerShell
"windows": {
"command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe",
"args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ]
},
"powershellcore-windows" : {
"command" :"${env:programfiles}/PowerShell/*/pwsh.exe",
"args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ]

},
"powershellcore-linux": {
"command": "/usr/bin/pwsh",
"args": [ "-NoProfile" ]
},
"powershellcore-osx": {
"command": "/usr/local/bin/pwsh",
"args": [ "-NoProfile" ]
},

// Associate with test task runner
"version": "2.0.0",
"tasks": [
{
"taskName": "Test",
"suppressTaskName": true,
"isTestCommand": true,
"args": [
"Write-Host 'Invoking Pester...'; $ProgressPreference = 'SilentlyContinue'; Invoke-Pester -Script test -PesterOption @{IncludeVSCodeMarker=$true};",
"Invoke-Command { Write-Host 'Completed Test task in task runner.' }"
],
"problemMatcher": "$pester"
"label": "Pester Test",
"type": "shell",
"command": "Get-Module Pester | Remove-Module;import-module -FullyQualifiedName @{ModuleName='Pester';RequiredVersion='4.10.1'};Invoke-Pester -Script .\\tests\\*test*.ps1 -PesterOption @{IncludeVSCodeMarker=$true}",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
},
{
"label": "Build markdown help files",
"type": "shell",
"command": "Import-Module $pwd\\*.psd1 -force;$module = Split-Path $pwd -leaf;New-MarkdownHelp -module $module -output $pwd\\docs -force",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
},
{
"label": "Add markdown help file",
"type": "shell",
"command": "Import-Module $pwd\\*.psd1 -force;$module = Split-Path $pwd -leaf;$cmd = Read-Host 'What command needs help?';New-MarkdownHelp -command $cmd -output $pwd\\docs -force;code $pwd\\docs\\$cmd.md",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
},
{
"label": "Update markdown help file",
"type": "shell",
"command": "Import-Module $pwd\\*.psd1 -force;$module = Split-Path $pwd -leaf;$cmd = Read-Host 'What command needs UPDATED help?';Update-MarkdownHelp -path $pwd\\docs\\$cmd.md -force;code $pwd\\docs\\$cmd.md",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
},
{
"label": "Build PowerShell module external help",
"type": "shell",
"command": "c:\\scripts\\build-externalhelp.ps1",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
},
{
"label": "Push release to GitHub WHATIF",
"type": "shell",
"command": "c:\\scripts\\GitReleasePush.ps1 -whatif",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
},
{
"label": "Push PREVIEW release to GitHub",
"type": "shell",
"command": "c:\\scripts\\GitReleasePush.ps1 -PREVIEW",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
},
{
"label": "Push release to GitHub",
"type": "shell",
"command": "c:\\scripts\\GitReleasePush.ps1",
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noprofile"
]
}
}
}
]
}
]
}
61 changes: 26 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,43 @@

[![PSGallery Version](https://img.shields.io/powershellgallery/v/WindowsUpdateSetting.png?style=for-the-badge&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/WindowsUpdateSetting/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/WindowsUpdateSetting.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/WindowsUpdateSetting/)

The PowerShell commands in this module are intended to make it easier to automate the process of pausing and resuming Windows Updates on a Windows 10 desktop as well as a few other update related settings. This module will not work on Windows 10 Home. If you are running Windows 10 Enterprise, your settings may be managed via Group Policy, in which case you won't be able to use this module.
The PowerShell commands in this module are intended to make it easier to automate the process of pausing and resuming Windows Updates on a Windows 10 desktop as well as a few other update-related settings. This module will not work on Windows 10 Home. If you are running Windows 10 Enterprise, your settings may be managed via Group Policy, in which case you won't be able to use this module.

You can install the latest version of this module from the PowerShell Gallery. It has been tested with PowerShell 7 on a Windows platform.
You can install the latest version of this module from the PowerShell Gallery.

```powershell
Install-Module WindowsUpdateSetting
```

The module should work on PowerShell Core running on a Windows platform.
The module should work on PowerShell 7 running on a Windows platform.

## Command Overview

[Get-WindowsActiveHours](./docs/Get-WindowsActiveHours.md)

[Get-WindowsUpdateDeferral](./docs/Get-WindowsUpdateDeferral.md)

[Get-WindowsUpdateSetting](./docs/Get-WindowsUpdateSetting.md)

[Resume-WindowsUpdate](./docs/Resume-WindowsUpdate.md)

[Set-WindowsActiveHours](./docs/Set-WindowsActiveHours.md)

[Set-WindowsUpdateDeferral](./docs/Set-WindowsUpdateDeferral.md)

[Suspend-WindowsUpdate](./docs/Suspend-WindowsUpdate.md)

[Test-IsWindowsUpdatePaused](./docs/Test-IsWindowsUpdatePaused.md)
- [Get-WindowsActiveHours](./docs/Get-WindowsActiveHours.md)
- [Get-WindowsUpdateDeferral](./docs/Get-WindowsUpdateDeferral.md)
- [Get-WindowsUpdateSetting](./docs/Get-WindowsUpdateSetting.md)
- [Resume-WindowsUpdate](./docs/Resume-WindowsUpdate.md)
- [Set-WindowsActiveHours](./docs/Set-WindowsActiveHours.md)
- [Set-WindowsUpdateDeferral](./docs/Set-WindowsUpdateDeferral.md)
- [Suspend-WindowsUpdate](./docs/Suspend-WindowsUpdate.md)
- [Test-IsWindowsUpdatePaused](./docs/Test-IsWindowsUpdatePaused.md)

## Suspend and Resume Windows Updates

Normally, you would use Settings to pause Windows Update for 35 days.

![settings](./assets/settings.png)
![settings](assets/settings.png)

You can use this module to toggle that setting from a PowerShell prompt.

```powershell
PS C:\> Suspend-WindowsUpdate -passthru
Computername : BOVINE320
UpdatesPaused : True
PauseStartUTC : 9/20/2018 2:06:28 PM
PauseEndUTC : 10/25/2018 2:06:28 PM
Remaining : 35.03:59:59.1529862
Computername: PROSPERO
Paused PauseStartUTC PauseEndUTC TimeRemaining
------ ------------- ----------- -------------
True 8/9/2023 8:27:34 PM 9/13/2023 8:27:34 PM 35.03:59:59
```

Or you can specify a date, as long as it is less than 35 days. Use `Get-WindowsUpdateSetting` to view the current values or `Test-IsWindowsUpdatePaused` to test.
Expand All @@ -54,28 +47,28 @@ Or you can specify a date, as long as it is less than 35 days. Use `Get-WindowsU

This module also contains commands to set your active hours.

![activehours](./assets/activehours.png)
![set active hours](assets/activehours.png)

```powershell
PS C:\> Get-WindowsActiveHours
Computername ActiveHoursStart ActiveHoursEnd
------------ ---------------- --------------
BOVINE320 6 21
Computername Start End
------------ ----- ---
PROSPERO 06:00 AM 10:00 PM
PS C:\> Set-WindowsActiveHours -StartTime 6:00 -EndTime 20:00 -Passthru
PS C:\> Set-WindowsActiveHours -StartTime 8:00 -EndTime 20:00 -Passthru
Computername ActiveHoursStart ActiveHoursEnd
------------ ---------------- --------------
BOVINE320 6 20
Computername Start End
------------ ----- ---
PROSPERO 08:00 AM 08:00 PM
```

## Configure Update Deferral

The module also contains commands to manage deferrals of certain updates.

![deferrals](./assets/deferrals.png)
![deferrals](assets/deferrals.png)

You can view and modify these settings.

Expand All @@ -95,5 +88,3 @@ BOVINE320 30 7
```

**You should test all of these commands on a non-production system.**

*last updated 23 October 2018*
Loading

0 comments on commit d0d15bf

Please sign in to comment.