Skip to content

Instantly share code, notes, and snippets.

@gabrielcnr
gabrielcnr / ad.py
Last active October 4, 2021 18:18
active directory
# -*- coding: iso-8859-1 -*-
"""active_directory - a lightweight wrapper around COM support
for Microsoft's Active Directory
Active Directory is Microsoft's answer to LDAP, the industry-standard
directory service holding information about users, computers and
other resources in a tree structure, arranged by departments or
geographical location, and optimized for searching.
There are several ways of attaching to Active Directory. This
@signalwarrant
signalwarrant / Get-3rdPartySoftware.ps1
Last active October 4, 2021 18:07
Get-3rdPartySoftware.ps1
<#
.DESCRIPTION
Uses some WMI and reading some Registry keys to get the version numbers for
McAfee Security Center, DAT, HIP, Plash Player, Java, Adobe Acrobat, Reader and AIR.
All of the results are put into a CSV file with the computername, IP Address, MAC Address and Serial Number
.NOTES
File Name: get-3rdPartySoftware.ps1
Author: David Hall
Contact Info:
@signalwarrant
signalwarrant / Force-WSUScheckin.ps1
Last active October 4, 2021 18:07
Force-WSUSchechin.ps1
# *** THIS SCRIPT IS PROVIDED WITHOUT WARRANTY, USE AT YOUR OWN RISK ***
<#
.DESCRIPTION
Starts the Windows Update service (wuauserv) if it is stopped and forces a checkin with the WSUS Server.
This function uses the Invoke-Command CMDlet which will require PSRemoting to be enabled on the target machine.
.NOTES
File Name: force-WSUScheckin.ps1
Author: David Hall
Contact Info:
@meetpradeepp
meetpradeepp / ms_ad_connect.py
Created August 2, 2020 10:56
Microsoft Active Directory Connect and Search users and Groups
# ms_ad_connect.py
#
# Code to query microsoft active directory
#
#
#
#
import sys
import ldap3
@signalwarrant
signalwarrant / Get-Help.ps1
Last active October 4, 2021 18:07
Get-Help.ps1
# Update all of the helpfiles
Update-Help
# Find all the modules that accept updated help
Get-Module -ListAvailable | Where-Object HelpInfoUri
# Save the help files to the local machine
Save-help -Force -DestinationPath 'D:\SaveHelp'
# Use either command below to access helpfiles
# Get all Modules, Functions, Alias' ...etc available on your computer
Get-Command -all
# Search for all cmdlets that contain Service in the noun portion.
Get-command –noun Service
# Search for all cmdlets that contain Stop in the verb portion
Get-Command -Verb Stop
# You can also use the * character as a wildcard
# You must have Chocolately installed first
# Usage example
# Install-MySoftware -Computers dc1,dc2,svr12,svr16 -Packages 'powershell.portable','microsoft-edge','microsoft-windows-terminal'
Function Install-MySoftware {
[CmdletBinding()]
Param(
[Parameter()]
[string[]]$Computers,
# Install Chocolatey
Invoke-Command -ComputerName DC -ScriptBlock {
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -y allowGlobalConfirmation
}
@tommymaynard
tommymaynard / technet-active_directory_user_lookup_form.ps1
Last active March 18, 2023 06:08
Active Directory User Lookup Form
<#
TechNet Contribution: Active Directory User Lookup Form
Previous link: https://gallery.technet.microsoft.com/Active-Directory-User-d8ee6a0c
Downloaded: 1,034 times (as of 05/21/2020)
This PowerShell script creates a PowerShell form to search for users in Active Directory by Username (SamAccountName).
The form returns a user's Name, Distinguished Name, Email, Title, and Office Phone. You can read more about the form's
development at http://tommymaynard.com/script-sharing-active-directory-user-lookup-form-2015.
Update to 2.1: 2015-07-23 (see code for changes).
Function Get-Inventory {
<#
.SYNOPSIS
Gets a variety of computer information remotely and exports it to
a CSV file.
.PARAMETER Computers
Specifies the Computer names of devices to query
.INPUTS