Skip to content

Instantly share code, notes, and snippets.

View cyberautomate's full-sized avatar

cyberautomate

View GitHub Profile
# 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
<#
DESCRIPTION
Reads a txt file containing computer names and attempts to ping each machine. If the ping is successful,
Copy the contents of c:\Install from the source computer to c:\install on the target machine.
Once the copy is complete test that the install package is present (in my case the Adobe Reader DC offline installer)
and then launch the installation silently with no reboot or user interaction required.
This example uses the Adobe Reader install package but it can easily be modified to install other software packages.
REQUIREMENTS
1. The appropriate rights to ping and copy on the remote machine.
<#
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
EXAMPLE
.\get-3rdPartySoftware.ps1 -ComputerName CL1
.\get-3rdPartySoftware.ps1 -ComputerName CL1, CL2
.\get-3rdPartySoftware.ps1 -ComputerName (Get-Content -Path "C:\computers.txt")
#>
<#
DESCRIPTION
Read Active Directory group info from groups.csv and create the groups.
Example CSV File:
GroupName GroupCategory GroupScope OU
Finance Security Global OU=_Groups,DC=signalwarrant,DC=local
R&D Security Global OU=_Groups,DC=signalwarrant,DC=local
IT Security Global OU=_Groups,DC=signalwarrant,DC=local
HR Security Global OU=_Groups,DC=signalwarrant,DC=local
#region Variables
######################################
# Variables
######################################
# Get the date for the filename
$date = (Get-Date -Format d_MMMM_yyyy).toString()
# Where to ouput the html file
$filePATH = "$env:userprofile\Desktop\"
# Define the filename
<#
DESCRIPTION
Use the New-Mailbox cmdlet to create mailboxes. The script will prompt you for the default password for all users.
All accounts are set to prompt the user to change the password at first logon. It then prompts for what
OU you want to put the users in, change the OU variable AD paths and variable names to correspond
to your AD structure. Once the users are created a log file is written to the $logPath.
REQUIREMENTS
1. If you run this script from somewhere other than Exchange server you will need Exchange Management tools installed.
2. The mailbox.csv file filled out.
<#
DESCRIPTION
Creates Active Directory Users in Bulk using a CSV file. Requires a typed password
and a confirmation that matches to execute.
#>
###############################################################
#
# Confirm-Password function
#
# DO NOT EVER WRITE CODE WITH PASSWORDS IN CLEAR TEXT
$ou = "OU=_Test_Users,DC=signalwarrant,DC=local"
$file = 'c:\scripts\users.csv'
$password = "P@ssword123456"
Import-CSV $file | ForEach-Object {
$user = New-ADUser `
-Name ($_.Name) `
-SamAccountName ($_.samAccountName) `
-Path $ou `
<#
DESCRIPTION
1. Search an OU for user accounts that have not authenticated in x number of days ($days)
2. Disable those accounts
3. Move those disabled user accounts to another OU ($disabledOU)
4. Also creates a logfile of all the users that were disabled ($logpath)
EXAMPLE
.\Get-StaleUsers.ps1
#>
<#
DESCRIPTION
Use the win32_LogicalDisk WMI Class to get Local Disk Information for one
or multiple computers.
Information gathered:
System Name DeviceID Volume Name Size(GB) FreeSpace(GB) % FreeSpace(GB) Date
Output options include Out-Gridview, a Table, CSV file and an HTML file.
#>