Skip to content

Instantly share code, notes, and snippets.

View systemcenterblog's full-sized avatar

systemcenterblog

View GitHub Profile
#Disconnect sessions from multiple servers using powershell script#
# Found on https://mydailytechnicalskills.blogspot.com/2017/06/disconnect-sessions-from-multiple.html #
#Script no warranty#
function Get-Sessions
{
$queryResults = query session
$starters = New-Object psobject -Property @{"SessionName" = 0; "UserName" = 0; "ID" = 0; "State" = 0; "Type" = 0; "Device" = 0;}
foreach ($result in $queryResults)
{
$AppBlackList =
"Microsoft.3DBuilder_8wekyb3d8bbwe",
"Microsoft.BingWeather_8wekyb3d8bbwe",
"Microsoft.DesktopAppInstaller_8wekyb3d8bbwe",
"Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe",
"Microsoft.GetHelp_8wekyb3d8bbwe",
"Microsoft.Getstarted_8wekyb3d8bbwe",
"Microsoft.Messaging_8wekyb3d8bbwe",
"Microsoft.Microsoft3DViewer_8wekyb3d8bbwe",
"Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe",
#Parameters SetupConfig.ini
[string] $PPriorityValue = 'High'
[string] $PostOOBEValue = 'C:\ProgramData\OSConfig\setupcomplete.cmd'
[string] $Value3 = 'powershell.exe -executionpolicy bypass -file C:\ProgramData\OSConfig\Background\Set-Background.ps1'
[string] $Value2 = 'powershell.exe -executionpolicy bypass -file C:\ProgramData\OSConfig\Start\Set-StartLayout.ps1'
[string] $Value = 'MsiExec.exe /X {F14000BE-0001-6400-0000-074957833700} /qn'
#Variable for ini file path
<#
Script Disclaimer: The sample scripts provided here are not supported under any Microsoft standard support program or service. All scripts are provided AS IS without warranty of any kind.
Server Group - Drain Stop Script
Collects current operation status of all nodes in Cluster - i.e. Paused, Running
Checks if Localhost is Paused -- $LocalNodeStatus=$True
Checks if additional nodes in cluster are paused $AdditionalNodeStatus=$True
If $LocalNodeStatus=$False and $AdditionalNodeStatus=False Drain Stop the local node
Checks that the local node is in Paused State
if (Get-Process | ?{$_.Name -eq “msdt”}) { Return 0 } else { }
#Setting the log location
$env:LogPath = "$env:ProgramData\CompanyName\Logs"
#Checking the log path
if((Test-Path $env:logpath) -eq $False)
{
New-Item -path $env:LogPath -type directory
}
#Starting the log file
@systemcenterblog
systemcenterblog / SCCMServerGroups.sql
Last active May 18, 2018 09:58
SCCM Server Groups Report
/* Script Disclaimer: The sample scripts provided here are not supported under any Microsoft standard support program or service.
All scripts are provided AS IS without warranty of any kind.
*/
Select
c.Name [CollectionName],
LastModificationTime,
UseCluster,
UseClusterPercentage,
PreAction,
PostAction,
@systemcenterblog
systemcenterblog / Job error (0x80004005).ps1
Last active September 8, 2023 18:41
Job error (0x80004005) Unable to read existing WUA Group Policy object
<#
Script Disclaimer: The sample scripts provided here are not supported under any Microsoft standard support program or service.
All scripts are provided AS IS without warranty of any kind.
ERRORS:
UpdatesDeployment.log
Job error (0x80004005) received for assignment ({bf7a48e6-d220-4070-bb9b-ecc239107584}) action UpdatesDeploymentAgent 12/6/2017 10:32:27 AM 2096 (0x0830)
WUAHandler.log
Unable to read existing WUA Group Policy object. Error = 0x80004005. WUAHandler 12/6/2017 3:41:00 AM 2828 (0x0B0C)