-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable local installs when WinRM is Disabled (#194)
* works * updates * Update pester.ps1 * ugh * Update pester.ps1 * Update pester.ps1 * made that mof a mof * Update pester.ps1 * undo * do not enable winrm * Update pester.ps1 * fix * upd * fix install of KB2267602 * Update windows-ci.yml * Update windows-ci.yml * Update windows-ci.yml * Update windows-ci.yml * remove line * Update windows-ci.yml
- Loading branch information
1 parent
48b2f46
commit 5937c35
Showing
3 changed files
with
247 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,27 +14,99 @@ jobs: | |
modules-to-cache: PSFramework, PSSQLite | ||
shell: powershell, pwsh | ||
|
||
- name: Starting services and enabling WinRM | ||
- name: Starting services and disabling WinRM | ||
shell: powershell | ||
run: | | ||
Write-Output "Starting services" | ||
Set-Service wuauserv -StartupType Automatic | ||
Set-Service WinRM -StartupType Automatic | ||
Start-Service wuauserv | ||
Write-Output "Enabling WinRM" | ||
winrm quickconfig -quiet | ||
Write-Output "Disabling WinRM" | ||
Set-Service WinRM -StartupType Disabled | ||
Get-Service WinRM | Stop-Service -ErrorAction Continue | ||
#Disable-PSRemoting -Force -ErrorAction Ignore | ||
#winrm delete winrm/config/Listener?Address=*+Transport=HTTP | ||
#winrm quickconfig -quiet | ||
- name: Run Test-WSMan | ||
shell: powershell | ||
run: | | ||
Test-WSMan -ErrorAction Continue | ||
- name: Downloading kbupdate-library and scanfile | ||
shell: powershell | ||
run: | | ||
Write-Output "Downloading freshest library" | ||
Install-Module kbupdate-library -Confirm:$false -Force | ||
Import-Module ./kbupdate.psd1 -ErrorAction Stop | ||
- name: Getting needed updates | ||
shell: powershell | ||
run: | | ||
Write-Output "Importing kbupdate module" | ||
Import-Module ./kbupdate.psd1 -ErrorAction Stop | ||
Write-Output "Getting needed updates" | ||
Get-KbNeededUpdate -ScanFilePath C:\temp\wsusscn2.cab -OutVariable needed -ErrorAction Stop -EnableException | Select-Object -First 1 -OutVariable saveit | ||
$null = mkdir C:\temp\xml | ||
Write-Output "Found $($needed.Count) needed updates" | ||
Write-Output "Will try to install $($saveit.Count) update" | ||
$saveit | Export-CliXml -Path C:\temp\xml\results.xml | ||
$null = $saveit | Save-KbUpdate -Path C:\temp | ||
- name: Installing updates | ||
shell: powershell | ||
run: | | ||
Import-Module ./kbupdate.psd1 -ErrorAction Stop | ||
$saveit = Import-CliXml -Path C:\temp\xml\results.xml | ||
Write-Output "Installing needed updates" | ||
try { | ||
$saveit | Install-KbUpdate -RepositoryPath C:\temp -Verbose -ErrorAction Stop -EnableException | ||
if ($($saveit.Count) -gt 0) { | ||
Get-KbInstalledSoftware -Pattern $needed.KBUpdate | ||
} | ||
} catch { | ||
$error[0] | select * | ||
throw $PSItem | ||
} | ||
Write-Output "Saving scanfile" | ||
Save-KbScanFile -Path C:\temp -AllowClobber | ||
second: | ||
name: Let's try another VM | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install and cache PowerShell modules | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
modules-to-cache: PSFramework, PSSQLite | ||
shell: powershell, pwsh | ||
|
||
- name: Starting services and disabling WinRM | ||
shell: powershell | ||
run: | | ||
Write-Output "Starting services" | ||
Set-Service wuauserv -StartupType Automatic | ||
Start-Service wuauserv | ||
Write-Output "Disabling WinRM" | ||
Set-Service WinRM -StartupType Disabled | ||
Get-Service WinRM | Stop-Service -ErrorAction Continue | ||
#Disable-PSRemoting -Force -ErrorAction Ignore | ||
#winrm delete winrm/config/Listener?Address=*+Transport=HTTP | ||
#winrm quickconfig -quiet | ||
- name: Run Test-WSMan | ||
shell: powershell | ||
run: | | ||
Test-WSMan -ErrorAction Continue | ||
- name: Downloading kbupdate-library and scanfile | ||
shell: powershell | ||
run: | | ||
Write-Output "Downloading freshest library" | ||
Install-Module kbupdate-library -Confirm:$false -Force | ||
Import-Module ./kbupdate.psd1 -ErrorAction Stop | ||
- name: Getting needed updates | ||
shell: powershell | ||
run: | | ||
|
@@ -55,7 +127,12 @@ jobs: | |
Import-Module ./kbupdate.psd1 -ErrorAction Stop | ||
$saveit = Import-CliXml -Path C:\temp\xml\results.xml | ||
Write-Output "Installing needed updates" | ||
$saveit | Install-KbUpdate -RepositoryPath C:\temp -Verbose | ||
if ($($saveit.Count) -gt 0) { | ||
Get-KbInstalledSoftware -Pattern $needed.KBUpdate | ||
try { | ||
$saveit | Install-KbUpdate -RepositoryPath C:\temp -Verbose -ErrorAction Stop -EnableException | ||
if ($($saveit.Count) -gt 0) { | ||
Get-KbInstalledSoftware -Pattern $needed.KBUpdate | ||
} | ||
} catch { | ||
$error[0] | select * | ||
throw $PSItem | ||
} |
Oops, something went wrong.