Skip to content

Instantly share code, notes, and snippets.

View GodfatherX64's full-sized avatar
🖥️
There’s no place like ::1/128

Mahmoud Farag GodfatherX64

🖥️
There’s no place like ::1/128
  • 127.0.0.1
  • 03:14 (UTC +03:00)
View GitHub Profile
@GodfatherX64
GodfatherX64 / Get-PrintedDocs.ps1
Created August 16, 2021 12:52 — forked from 9to5IT/Get-PrintedDocs.ps1
PowerShell: Get list of printed documents
$aPrinterList = @()
$StartTime = "11/01/2013 12:00:01 PM"
$EndTime = "11/01/2013 6:00:01 PM"
$Results = Get-WinEvent -FilterHashTable @{LogName="Microsoft-Windows-PrintService/Operational"; ID=307; StartTime=$StartTime; EndTime=$EndTime;} -ComputerName "print-01"
ForEach($Result in $Results){
$ProperyData = [xml]$Result.ToXml()
$PrinterName = $ProperyData.Event.UserData.DocumentPrinted.Param5
@GodfatherX64
GodfatherX64 / Get-AccountLockouts.ps1
Created August 16, 2021 12:52 — forked from 9to5IT/Get-AccountLockouts.ps1
PowerShell: Get-WinEvent to find Account Lockout Events
#requires -version 2
<#
.SYNOPSIS
Lists date, time and machine name where the specified account was locked. Used for troubleshooting account lockout issues.
.DESCRIPTION
This script outputs to specified file all of the recent account lockouts that have occurred for the specified user. The results returned are the machine name where this has occurred and the data & time it occurred at. This script is very useful for troubleshooting account lockout issues.
Note: This script only searches current security logs on the domain controllers specified within the $DCs variable
@GodfatherX64
GodfatherX64 / Logging_Functions.ps1
Created August 16, 2021 12:52 — forked from 9to5IT/Logging_Functions.ps1
PowerShell: Logging Functions
Function Log-Start{
<#
.SYNOPSIS
Creates log file
.DESCRIPTION
Creates log file with path and name that is passed. Checks if log file exists, and if it does deletes it and creates a new one.
Once created, writes initial logging data
.PARAMETER LogPath
@GodfatherX64
GodfatherX64 / Script_Template.ps1
Created August 16, 2021 12:52 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@GodfatherX64
GodfatherX64 / Encryption_Functions.ps1
Created August 16, 2021 12:52 — forked from 9to5IT/Encryption_Functions.ps1
PowerShell: Encryption Functions
Function Set-EncryptKey{
<#
.SYNOPSIS
Used to create an encryption \ decryption key
.DESCRIPTION
This function is used to create an encrytpion \ decryption key that will be used in conjunction with PowerShell cmdlets and functions to encrypt and decrypt data.
The key needs to be between 16 and 32 characters in length.
.PARAMETER Key
@GodfatherX64
GodfatherX64 / Get-ADUserInfo.ps1
Created August 16, 2021 12:52 — forked from 9to5IT/Get-ADUserInfo.ps1
PowerShell: Get Active Directory User Information
Import-Module ActiveDirectory
$aResults = @()
$List = Get-Content ".\List.txt"
ForEach($Item in $List){
$Item = $Item.Trim()
$User = Get-ADUser -Filter{displayName -like $Item -and SamAccountName -notlike "admin-*" -and Enabled -eq $True} -Properties SamAccountName, GivenName, Surname, telephoneNumber, mail
$hItemDetails = New-Object -TypeName psobject -Property @{
@GodfatherX64
GodfatherX64 / Send-Email.ps1
Created August 16, 2021 12:52 — forked from 9to5IT/Send-Email.ps1
PowerShell: Send Email
Function Send-Email{
<#
.SYNOPSIS
Used to send data as an email to a list of addresses
.DESCRIPTION
This function is used to send an email to a list of addresses. The body can be provided in HTML or plain-text
.PARAMETER EmailFrom
Mandatory. The email addresses of who you want to send the email from. Example: "admin@9to5IT.com"
@GodfatherX64
GodfatherX64 / iframe-example.html
Created August 16, 2021 12:51 — forked from 9to5IT/iframe-example.html
HTML: Disabling mouse scrolling in iFrame (Example: Disable zooming for Google Maps iframe)
<iframe style="pointer-events:none;" src=""></iframe>
EXAMPLE Google Maps iFrame:
-----------------------------
<iframe style="pointer-events:none; border:0;" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3540.087495492481!2d153.02746689999998!3d-27.466535299999965!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b915a1d2f662eb3%3A0x4f3c5ce2c1aafa48!2sAdelaide+St%2C+Brisbane+QLD+4000!5e0!3m2!1sen!2sau!4v1412077371383" width="600" height="300" frameborder="0"></iframe>
@GodfatherX64
GodfatherX64 / powercli_script_template.ps1
Created August 16, 2021 12:51 — forked from 9to5IT/powercli_script_template.ps1
PowerShell: PowerCLI Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@GodfatherX64
GodfatherX64 / Duplicate-PortGroups.ps1
Created August 16, 2021 12:51 — forked from 9to5IT/Duplicate-PortGroups.ps1
PowerShell: Duplicate Port Groups from one vDS to another using PowerCLI
#requires -version 3
<#
.SYNOPSIS
Copies port groups and all of their settings from one vDS to another vDS
.DESCRIPTION
This script is used to duplicate port groups (and their settings) from one vDS to another vDS.
This is useful if you want to create a duplicate vDS with the same configuration as the original
.PARAMETER