Skip to content

Instantly share code, notes, and snippets.

View zbalkan's full-sized avatar
💻
back again

Zafer Balkan zbalkan

💻
back again
View GitHub Profile
function New-RemoteScheduledTask {
[CmdletBinding()]
param (
# Hostname to create the task on
[string]
$Hostname,
# Credentials for connecting to the host
[System.Management.Automation.PSCredential]
$Credential,
# Windows settings
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -EnableOpenFileExplorerToQuickAccess
Set-TaskbarOptions -Size Large -UnLock -Dock Bottom -Combine Never -AlwaysShowIconsOn
Enable-RemoteDesktop
Install-WindowsUpdate
# Chocolatey Packages
# Libraries
cinst dotnetfx
cinst dotnetcore-sdk
@zbalkan
zbalkan / Export ADS.ps1
Last active July 21, 2019 14:03
A simple function to export NTFS Alternate Data Streams (ADS) of a specified file as symbolic links.
function Export-ADS (){
[CmdletBinding()]
param (
$Path
)
process {
Get-Item $Path -Stream * |
Select-Object -Property Stream -Skip 1 |
ForEach-Object {
$item = Get-Item $Path
@zbalkan
zbalkan / Send-MailMessage2.ps1
Last active October 9, 2019 13:07
A modified version of Send-MailMessage that utilizes Exchange Server in the domain as SMTP server and `env:USERNAME` as credential
<#
.Synopsis
Sends an email message using existing Exchange Server with user's credential.
.DESCRIPTION
The Send-MailMessage2 cmdlet sends an email message from within Windows PowerShell. It utilizes Autodiscovery feature of Exchange Server.
.EXAMPLE
Send an email from one user to another:
PS C:\>Send-MailMessage2 -To "User01 <user01@example.com>" -Subject "Test mail"
This file has been truncated, but you can view the full file.
::1 localhost
127.0.0.1 localhost
51.75.66.169 vps607578.ovh.net vps607578
127.0.1.1 vps607578.ovh.net vps607578
127.0.1.1 vps607578 vps607578
# NSABlocklist begins here
127.0.0.1 108.61.165
127.0.0.1 130.117.50.166
@zbalkan
zbalkan / Hack.ps1
Last active August 27, 2020 10:58
Add-Type -Assembly System.Windows.Forms
$script:MainForm = New-Object System.Windows.Forms.Form
$script:MainForm.Text = ''
$script:MainForm.Width = 600
$script:MainForm.Height = 400
$script:MainForm.AutoSize = $false
$script:MainForm.TopMost = $true
$script:MainForm.FormBorderStyle = 'None'
$script:MainForm.WindowState = 'Maximized'
$script:MainForm.BackColor = 'Black'
@zbalkan
zbalkan / Boxstarter_Win10.ps1
Last active August 27, 2020 10:59
My default Boxstarter script
# Windows settings
# TODO: Add Win10 bloatware cleanup
# Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -EnableOpenFileExplorerToQuickAccess
# Set-TaskbarOptions -Size Large -UnLock -Dock Bottom -Combine Never -AlwaysShowIconsOn
# Enable-RemoteDesktop
# Disable-GameBarTips
# Disable-BingSearch
# Install-WindowsUpdate
# Chocolatey Packages
@zbalkan
zbalkan / Copy Local ESXi users and roles.ps1
Last active November 10, 2020 19:43
This script was created when I needed to add some local accounts on ESXi hosts for compliance. It would take time so I only prepared first host. This script gets users, roles and permissions from the source host and creates them on target host. It's possible to enumerate other hosts and apply them, but I tested for possible trying errors one by …
#Hosts
$Source = "Source ESXi Server IP address/Hostname"
$Target = "Target ESXi Server IP address/Hostname"
# Creds
$root = "root"
$rootPassword = "root password"
$admin = "administrator@vsphere.local" # Not used here. It will be needed when enumerating all hosts.
$adminPassword = "administrator password" # Not used here. It will be needed when enumerating all hosts.
@zbalkan
zbalkan / id_rsa.pub
Created February 7, 2021 17:04
public
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDh53gwlEcTH9HXjfJ9ojVFn3WhWHVcH52rkGWpn1nq/jXb2+qhiefS10DpRQDCyCCHOvc0vDgKUbD1bP7Qp97NacccOCMNaU8N120tQe/UrN4MM/5RLjYk2rNwUn3HdERIHUWG3DE9Xa2kGadO3/69aaDGNw9sFk+FwkiwUpi5xhV8WjZf6FRZmlkVpPf3g3id+AH1boNFVUdiR6A3rO3EPXTsJq3Ib8I3e3U6do6OkEOLp0Ot1DdDhIrNm3OsahYyGZ6jiFJTOTbSIsiyNqqmIR/B3QK//6tzBVMz9klaQs08nMBLaywbsyvadPQJzdHMR8hk+d8InvQQh711oZaz zafer@HP
@zbalkan
zbalkan / Printer GPP.ps1
Last active February 25, 2021 12:08
A Powershell script that creates a printer GPP. It reads form a csv file.
# Configuration variables
$PrintServer = ""
$CSVFilePath = "printers.csv"
$XMLFilePath = "printers.xml"
# The code
Import-Module ActiveDirectory
$Domain = (Get-ADDomain).name