Skip to content

Instantly share code, notes, and snippets.

@theagreeablecow
theagreeablecow / Print_ServerJobLogs.ps1
Created June 2, 2012 01:00
Print Server Job Logs from Event Viewer to CSV using Get-WinEvent and XML queries
<#
.SYNOPSIS
Print server job logs from Event Viewer to csv file
.DESCRIPTION
This script uses Get-WinEvent and XML queries to retrieve EventID 307 job logs from print servers.
Specifically querying the Microsoft-Windows-PrintService/Operational log.
Log is extracted to a CSV file and optionally emailed.
.PARAMETER FileName
@theagreeablecow
theagreeablecow / ServerInventory.ps1
Created May 26, 2012 22:52
Server Inventory from Active Directory
# This script will generate a list of all servers in AD, collect inventory items and export to Excel
# Requires the Active Directory module for Windows Powershell and appropriate credentials
#LOAD POWERSHELL SESSIONS
#------------------------
$DC = "dc1.maydomain.com.au"
$usercredential= get-credential -credential mydomain\admin
$Path = "\\mydomain.com.au\Scripts\Data\"
$ExportFile = $Path + "ServerInventory.csv"
<#
.SYNOPSIS
Create a new desktop wallpaper from various sources and optionally overlay some text.
.DESCRIPTION
The script can be run manually, at logon or even as a scheduled task to update the wallpaper regularly
Wallpaper sources include:
- A solid colour
@theagreeablecow
theagreeablecow / 00 Module Variables.ps1
Last active May 11, 2023 22:05
SAMReport for Veeam
############################################################################################################
# Module Variables - Veeam #
#-------------------------------#
# Customise report Variables
$EmailTo = $EmailTo
$EmailSubject = $EmailSubject
$ReportTitle = $ReportTitle
$ReportSubTitle = $ReportSubTitle
@theagreeablecow
theagreeablecow / setupnewuser.ps1
Created May 24, 2012 10:30
Setup New User in AD, Exchange and Lync
# This script will set up AD, User Directories, Exchange and Lync, using basic data retrived from a CSV file
# Requires the Active Directory module for Windows Powershell and appropriate credentials
# CSV file with corresponding header and user(s) info:
# Office,UserName,FirstName,LastName,Initial,Department,Role,Title,SetupSameAs,Manager,MailboxAccess,Extension,Mobile
#LOAD POWERSHELL SESSIONS
#------------------------
$exchangeserver = "exchange1.domain.com"
$Lyncserver = "lync1.domain.com.au"
@theagreeablecow
theagreeablecow / 00 Module Variables.ps1
Last active April 30, 2020 14:37
SAMReport Module for PC Health
############################################################################################################
# Module Variables - PC Health #
#----------------------------------#
# Customise report Variables
$EmailTo = $EmailTo
$EmailSubject = $EmailSubject
$ReportTitle = $ReportTitle
$ReportSubTitle = $ReportSubTitle
@theagreeablecow
theagreeablecow / 00_Global_Variables.ps1
Last active July 4, 2018 00:18
SysAdmin Modular Reporting (SAMReports)
############################################################################################################
# Global Variables #
#------------------------
# Email Variables
$SmtpServer = "exchange.mydomain.com.au"
$EmailFrom = "SAMReports@mydomain.com.au"
$EmailTo = "administrator@mydomain.com.au"
$EmailSubject = "SysAdmin Modular Report for $module $($Date)"
@theagreeablecow
theagreeablecow / 00 Module Variables.ps1
Last active July 4, 2018 00:18
SAMReport Module for Exchange
############################################################################################################
# Module Variables - Exchange #
#----------------------------------#
# Customise report Variables
$EmailTo = $EmailTo
$EmailSubject = $EmailSubject
$ReportTitle = $ReportTitle
$ReportSubTitle = $ReportSubTitle
@theagreeablecow
theagreeablecow / 00 Module Variables.ps1
Last active July 4, 2018 00:18
SAMReport Module for SSL Certificates
############################################################################################################
# Module Variables - Certificates #
#-------------------------------------#
# Customise report Variables
$EmailTo = $EmailTo
$EmailSubject = $EmailSubject
$ReportTitle = $ReportTitle
$ReportSubTitle = $ReportSubTitle
@theagreeablecow
theagreeablecow / set-ADPhotos.ps1
Last active July 20, 2017 20:47
Add photos to Active Directory
<#
.SYNOPSIS
Import photos into Active Directory
.DESCRIPTION
- Source files are collected in bulk from network location and filtered on Last Modified Date
- Source files must be in the format username.jpg and will be checked against valid AD users
- The files are copied and processed in a temporary working directory
- The files are resized (retaining proportions) and imported into AD
- Both the original and new files are date stamped and backed up (see Exported and Imported folders)