Skip to content

Instantly share code, notes, and snippets.

View sanwil9's full-sized avatar

Steven Sanders sanwil9

View GitHub Profile
SELECT ds.SoftwareName AS Deployment
, ds.AssignmentID
, ds.CollectionName AS Collection
, ds.DeploymentTime
, ds.NumberSuccess
, ds.NumberErrors
, ds.NumberInProgress
, ds.NumberUnknown
, ds.NumberOther
, ds.NumberTotal
SELECT ds.SoftwareName AS Deployment
, ds.AssignmentID
, ds.CollectionName AS Collection
, ds.DeploymentTime
, ds.NumberSuccess
, ds.NumberErrors
, ds.NumberInProgress
, ds.NumberUnknown
, ds.NumberOther
, ds.NumberTotal
@sanwil9
sanwil9 / DeleteSCCMMachines.ps1
Created February 7, 2018 18:29
Delete Machines from SCCM
#Run this on machine with console
Get-CMDevice
$counter = 0
function removecomputers {
Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'
CD YOURSCCMDRIVE:
$computers = get-content YOUR FILE PATH GOES HERE \purgecomputers.txt
@sanwil9
sanwil9 / Create WS 2016 Reference Image.ps1
Created February 7, 2018 18:26
Create WS 2016 Reference Image
$ISO = "C:\Setup\ISO\Windows Server 2016.iso"
$CU = "C:\Setup\CU\windows10.0-kb3201845-x64_95e1e765344e1388fee3f7c0c143499e0b617d9f.msu"
$MountFolder = "C:\Mount"
$RefImage = "C:\Setup\REFWS2016-001.wim"
@sanwil9
sanwil9 / Generate CSV of Computers in Specific Container in AD.ps1
Last active February 7, 2018 18:21
Generate CSV of Computers in Specific Container in AD
###### Report to View Computers in a specific area in AD ###########
###### Specify the folder type in the SearchBase string, EX. OU,CN,etc. #######
$State= Read-Host -Prompt "Enter The State Abbreviation"
$City= Read-Host -Prompt "Enter City in the state you are searching"
@sanwil9
sanwil9 / Discover if Objects From Text File exists in AD and Out Grid View.ps1
Last active February 7, 2018 18:22
Discover if Objects From Text File exists in AD and Out Grid View to Screen For easy filtering
<#
.SYNOPSIS
<Verify if an object exists in AD>
.DESCRIPTION
<Input the file location and hit go to see the list after the function runs. From there you can copy/edit from the grid view editor.>
.NOTES
Version: 1.0
Author: <Steven Sanders>
Creation Date: <1/24/2018>
#>
@sanwil9
sanwil9 / Stop List of Services .ps1
Last active February 7, 2018 18:22
Stop List of Services With Validation
############# Setting Variables ################################
$serviceArray = ("smstsmgr", "CcmExec","CmRcService")
######### Stopping Service #####################################
foreach ($service in $serviceArray) {
Stop-Service -Name $service
@sanwil9
sanwil9 / View All Recent SCCM Application and Package Deployments.sql
Last active February 7, 2018 18:24
View All Recent SCCM Application/Package Deployments
SELECT
ds.SoftwareName AS Deployment
, ds.AssignmentID
, ds.CollectionName AS Collection
, ds.DeploymentTime
, ds.NumberSuccess
, ds.NumberErrors
, ds.NumberInProgress
, ds.NumberUnknown
, ds.NumberOther