Skip to content

Instantly share code, notes, and snippets.

View danjpadgett's full-sized avatar

Dan Padgett danjpadgett

View GitHub Profile
#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"
#requires -version 2
<#
.SYNOPSIS
Creates dart shortcuts in SCCM Share
.DESCRIPTION
Creates dart shortcuts in SCCM Share
.PARAMETER <Parameter_Name>
None
.INPUTS
None
@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 / 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
@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 / StartMBAMEncryption.WSF
Created January 25, 2018 17:34
StartMBAMEncryption.WSF
<job id="StartMBAMEncryption">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">
' // ***************************************************************************
' //
' // Copyright (c) Microsoft Corporation. All rights reserved.
' //
' // Microsoft Deployment Toolkit Solution Accelerator
' //
$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-RemoteLoggedUser.ps1
Last active January 11, 2018 12:33
Get-RemoteLoggedUser.ps1
$result = @()
$time = 1
$list = (Get-Content C:\Script\List.txt)
function get-LoggedInusers($i)
{
$Username = $null
$explorerprocesses = @(Get-WmiObject -ComputerName $i -Query "Select * FROM Win32_Process WHERE Name='explorer.exe'" -ErrorAction SilentlyContinue)
if ($explorerprocesses.Count -eq 0)
{
<#
.SYNOPSIS
Sets SCCM Site Code.
.DESCRIPTION
Checks for the SCCM site code against $DesiredSiteCode , if no match it will reassign the client, remove hardcoded registry values, and log results.
.NOTES
Version: 1.0
Author: dpadgett
Creation Date: 07/02/17
Purpose/Change: Production
$result = @()
$time = 1
$list = Get-Content .\list.txt
Foreach ($i in $list)
{
$intSize = $intSize + $objFile.Length
$resData = New-Object System.Object
$resData | Add-Member -type NoteProperty -name ComputerName -value $i