Skip to content

Instantly share code, notes, and snippets.

View duffney's full-sized avatar
⌨️
Coding

Josh Duffney duffney

⌨️
Coding
View GitHub Profile
@duffney
duffney / LCM_HTTPPULL.ps1
Created August 27, 2015 20:42
LCM_HTTPPULL.ps1
[DSCLocalConfigurationManager()]
Configuration LCM_HTTPPULL
{
param
(
[Parameter(Mandatory=$true)]
[string[]]$ComputerName,
[Parameter(Mandatory=$true)]
[string]$guid
@duffney
duffney / Config_HTTPPullServer.ps1
Created August 27, 2015 01:06
Config_HTTPPullServer.ps1
configuration HTTPPullServer
{
# Modules must exist on target pull server
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
Node WS2016P3
{
WindowsFeature DSCServiceFeature
{
Ensure = "Present"
@duffney
duffney / Stale-ADgroups.ps1
Created August 25, 2015 02:34
Stale-ADgroups.ps1
$StaleGroupsobj | where MemberCount -eq '0'`
| select Name,MemberCount,MemberofCount,DaysSinceChange`
| where MemberOfCount -eq '0' | where DaysSinceChange -GE '190'| ft
@duffney
duffney / Search-ADGroups.ps1
Last active September 1, 2015 02:15
Search-ADGroups.ps1
$StaleGroupsobj = @()
$DC = (Get-ADDomain).DNSroot
$Groups = (Get-ADGroup -Filter * -Server $DC).name
Foreach ($Group in $Groups){
$Group = Get-ADGroup -Filter {Name -eq $Group} -Properties Name, DistinguishedName, `
GroupCategory, GroupScope, whenCreated, whenChanged, member, `
memberOf, sIDHistory, SamAccountName, Description -Server $DC |
Select-Object Name, DistinguishedName, GroupCategory, GroupScope, `
whenCreated, whenChanged, member, memberOf, SID, SamAccountName, `
@duffney
duffney / Migrate-ADMTUserCLI.ps1
Last active August 29, 2015 14:28 — forked from RamblingCookieMonster/Migrate-ADMTUserCLI.ps1
This is an example function that wraps ADMT.exe, abstracting out migration of Active Directory users into a PowerShell function.
<#
This is a PowerShell function wrapping the ADMT executable to abstract out migrating Active Directory users.
Read all the ADMT docs, and all the code and comments below before considering using this : )
The COM object was covered nicely by Jan Egil Ring:
http://blog.powershell.no/2010/08/04/automate-active-directory-migration-tool-using-windows-powershell/
Unfortunately, the COM object does not support Include files, a critical requirement for us.