This file contains hidden or 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 -Modules Configuration, Pester, PSScriptAnalyzer | |
| try { | |
| Set-Location -Path $env:APPVEYOR_BUILD_FOLDER -ErrorAction Stop | |
| $timestamp = Get-Date -uformat "%Y%m%d-%H%M%S" | |
| $resultsFile = "Results_${timestamp}.xml" | |
| Import-Module -Name .\$env:APPVEYOR_PROJECT_NAME -Force -ErrorAction Stop | |
| Invoke-Pester -Path '.\Tests' -OutputFormat NUnitXml -OutputFile ".\$resultsFile" -PassThru -ErrorAction Stop | |
This file contains hidden or 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
| \Windows\SOFTWA~1\DATAST~1\DATAST~1.EDB | |
| \Windows\SoftwareDistribution\Datastore\DataStore.edb | |
| \Windows\SOFTWA~1\DATAST~1\Logs\*.jrs | |
| \Windows\SoftwareDistribution\Datastore\Logs\*.jrs | |
| \Windows\SOFTWA~1\DATAST~1\Logs\Edb.chk | |
| \Windows\SoftwareDistribution\Datastore\Logs\Edb.chk | |
| \Windows\SOFTWA~1\DATAST~1\Logs\Tmp.chk | |
| \Windows\SoftwareDistribution\Datastore\Logs\Tmp.chk | |
| \Windows\Security\Database\*.edb | |
| \Windows\Security\Database\*.sdb |
This file contains hidden or 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 | |
| Resets the requried components of the Windows Update Agent. | |
| .DESCRIPTION | |
| Stops required services. | |
| Removes cached files/folders used by the Windows Update Agent. | |
| Resets the permissions on the bits and wuauserv services. | |
| Registers dlls needed by the bits/Windows Update Agent. | |
| Removes lingering registry entries from SUS if present. | |
| Restarts all the services that where stopped. |
This file contains hidden or 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 | |
| Finds the nth index of a char in a string. | |
| .DESCRIPTION | |
| Finds the nth index of a char in a string, returns -1 if the char does not exist, or if nth is out of range. | |
| .INPUTS | |
| System.Char. | |
| System.String. | |
| System.Int. | |
| .OUTPUTS |
This file contains hidden or 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 -Modules Configuration, Pester, PSScriptAnalyzer | |
| [CmdletBinding()] | |
| [OutputType()] | |
| $ErrorActionPreference = "Stop" | |
| try { | |
| # Setup environment. | |
| Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Confirm:$false -Force | |
This file contains hidden or 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
| $members = Get-ADGroupMember -Identity "ActiveSyncUsers" | |
| foreach ($mailbox in (Get-CASMailbox -Filter { HasActiveSyncDevicePartnership -eq $true } -ResultSize Unlimited)) { | |
| # If the user is disabled, remove all paired devices and ensure the user is removed from the group. | |
| if ((Get-ADUser -Identity $mailbox.DistinguishedName).Enabled -eq $false) { | |
| foreach ($device in (Get-MobileDevice -Mailbox $mailbox.DistinguishedName)) { | |
| Remove-MobileDevice -Identity $device.Identity -Confirm:$false | |
| } | |
| if ($mailbox.DistinguishedName -in $members.DistinguishedName) { | |
| Remove-ADGroupMember -Identity "ActiveSyncUsers" -Members $mailbox.DistinguishedName -Confirm:$false |
This file contains hidden or 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 -RunAsAdministrator | |
| <# | |
| .SYNOPSIS | |
| This will remove all the folders to allow you to log back into battle.net. | |
| .DESCRIPTION | |
| This will remove all the folders to allow you to log back into battle.net. | |
| .INPUTS | |
| None | |
| .OUTPUTS |
This file contains hidden or 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
| $source = @' | |
| using System; | |
| using System.Security.Principal; | |
| using System.Runtime.InteropServices; | |
| namespace ECGCAT | |
| { | |
| public class Kernel32 | |
| { | |
| [DllImport("Kernel32.dll", SetLastError = true)] |
This file contains hidden or 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
| # Get the SID of the group to give Permissions to. | |
| $sid = ([System.Security.Principal.NTAccount]"DOMAIN\GROUPNAME").Translate( | |
| [System.Security.Principal.SecurityIdentifier] | |
| ) | |
| # Build an Access Control Entry object giving the group the Manage Documents permission. 983088 is the access mask for Manage Documents only. | |
| $ace = New-Object -TypeName System.Security.AccessControl.CommonAce -ArgumentList @( | |
| @([System.Security.AccessControl.AceFlags]::ObjectInherit, [System.Security.AccessControl.AceFlags]::InheritOnly), [System.Security.AccessControl.AceQualifier]::AccessAllowed, 983088, $sid, $false, $null | |
| ) |
This file contains hidden or 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 -module ActiveDirectory | |
| # Input computers. | |
| $threshold = (Get-Date).AddDays(-180) | |
| $computers = Get-ADComputer -Filter { OperatingSystem -notlike "*server*" -and OperatingSystem -like "*windows*" -and PasswordLastSet -gt $threshold } | | |
| Select-Object -ExpandProperty Name | | |
| Sort-Object -Property Name | |
| # Make sure there are not existing jobs. | |
| Get-Job | |