Skip to content

Instantly share code, notes, and snippets.

View danjpadgett's full-sized avatar

Dan Padgett danjpadgett

View GitHub Profile
$collectionname = Read-Host -Prompt "Enter collection name" 
$result = @()
$Data = Get-CMDeployment | ?{$_.collectionname -like "$collectionname"} | select collectionname, NumberErrors,NumberInProgress,NumberOther,NumberSuccess,NumberTargeted,NumberUnknown
foreach($entry in $Data){
$resData = New-Object System.Object
$resData | Add-Member -type NoteProperty -name Errors -value ($entry.numbererrors)
$resData | Add-Member -type NoteProperty -name InProgress -value ($entry.numberinprogress)
@danjpadgett
danjpadgett / Get-CmSiteCode.PS1
Created February 15, 2018 17:20
Get-CmSiteCode
$result = @()
$time = 1
$searchbase = 'OU=WORKSTATIONS,DC=COMPANY,DC=com'
$list = (Get-ADComputer -SearchBase $searchbase -Filter 'Enabled -eq $true').name
function Get-ComputerSite($i)
{
$site = nltest /server:$i /dsgetsite 2>$null
if($LASTEXITCODE -eq 0){ $site[0] }
}
@danjpadgett
danjpadgett / LoopIE
Last active February 16, 2018 16:29
LoopIE
<#
.NOTES
===========================================================================
Created by: Dan Padgett (C)
Organization: www.execmgr.net
Filename: LoopIE
Version: 3.0
===========================================================================
.SYNOPSIS
@danjpadgett
danjpadgett / CheckClientPushQueue.sql
Last active February 21, 2018 14:19
SCCM Client Push Request Queue
SELECT
m.[Name] AS [Computer Name]
,m.[LatestProcessingAttempt]
,m.[LastErrorCode]
,m.[Description]
, AD.AD_Site_Name0 AS [AD Site Name]
,m.[NumProcessAttempts]
FROM v_R_System AD
JOIN [CM_XXX].[dbo].[v_CP_Machine] m
#Set the Following Parameters
#To be run locally on ConfigMgr Source Server
$Source = 'E:\Source'
$ShareName = 'source$'
$NetworkAccount = 'contoso\SCCMAdmins'
#Create Source Directory
New-Item -ItemType Directory -Path "$Source"
@danjpadgett
danjpadgett / Customise-Win10.ps1
Last active March 28, 2018 16:16
Customise-Win10.ps1
<#
.SYNOPSIS
Sets W10 1709 Options
.DESCRIPTION
Sets W10 1709 Options
.PARAMETER <Parameter_Name>
None
.INPUTS
None
<#
.SYNOPSIS
Checks WSUS App Pool
.DESCRIPTION
Script will check status of WSUS APP Pool and if 'stopped' will email. Setup script as scheduled task on WSUS instance.
.NOTES
Version: 1.0
Author: dpadgett
Creation Date: 07/02/17
Purpose/Change: Production
@danjpadgett
danjpadgett / getTPMVersionStatus.sql
Created April 12, 2018 10:00
getTPMVersionStatus.sql
SELECT distinct CS.Manufacturer0 as 'Manufacturer',
CS.Model0 AS 'Model', CS.Name0 as 'Name', TPM.SpecVersion0 as 'SpecVersion',
TPM.IsActivated_InitialValue0 as 'IsActivated_InitialValue',
TPM.IsEnabled_InitialValue0 as 'IsEnabled_InitialValue',
TPM.IsOwned_InitialValue0 as 'IsOwned_InitialValue',
TPM.ResourceID,
OPSYS.Caption0 as 'OS',
OPSYS.CSDVersion0 as 'ServicePack',
GSBIOS.SMBIOSBIOSVersion0 as 'BIOS',
GSBIOS.SerialNumber0 as 'Serial No.'
Unlock
$SecureString = ConvertTo-SecureString "xxxxxx" -AsPlainText -Force
Unlock-BitLocker -MountPoint "D:" -Password $SecureString
EncryptD
.\manage-bde.exe -protectors -enable d:
$secure = ConvertTo-SecureString "xxxxxx" -AsPlainText -Force
@danjpadgett
danjpadgett / Office Channel.sql
Last active April 20, 2018 13:49
Office Channel
SELECT sys.Name0 [Computer Name] ,
"Update Channel" =
CASE
When O365.CDNBaseUrl00 = 'http://officecdn.microsoft.com/pr/7ffbc6bf-bc32-4f92-8982-f9dd17fd3114' Then 'Semi-Annual Channel'
When O365.CDNBaseUrl00 = 'http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60' Then 'Monthly Channel'
When O365.CDNBaseUrl00 = 'http://officecdn.microsoft.com/pr/b8f9b850-328d-4355-9145-c59439a0c4cf' Then 'Semi-Annual Channel (Targeted)'
When O365.CDNBaseUrl00 = 'http://officecdn.microsoft.com/pr/64256afe-f5d9-4f86-8936-8840a6a4f5be' Then 'Monthly Channel (Targeted)'
End
,