Skip to content

Instantly share code, notes, and snippets.

@bohack
bohack / Folder and File Permissions in Linux
Created April 24, 2019 19:28
Folder and File Permissions in Linux
find . \( -type d -exec chmod 775 {} \; \) -o \( -type f -exec chmod 664 {} \; \)
@bohack
bohack / License Windows and Office
Created April 17, 2019 13:37
License Windows and Office
@ECHO OFF
REM 03/11/19
REM Bohack
REM Activate both Microsoft OS and Office
ECHO Activating Windows
ECHO ------------------------------------
ECHO .
C:\WINDOWS\SYSTEM32\CSCRIPT.EXE C:\WINDOWS\SYSTEM32\SLMGR.VBS /ATO
ECHO.
ECHO Activating Office 2016
@bohack
bohack / VM Log Parser
Created April 8, 2019 17:53
VM Log Parser for VM Deletion Script.
' Jon Buhagiar
' 03/29/19
' Parses the log file of machines deleted
' Use this command first to remove interleave formatting
' TYPE log.txt > log2.txt
Option Explicit
Dim objFile, strLine, strInFile
Dim objFSO, intCNT, strOutput
WScript.Echo "Make sure to clean the file with type logxxxx.txt > logyyyy.txt before using this"
@bohack
bohack / autounattend.xml
Created December 13, 2018 18:07
UEFI AutoUnattend File
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>0409:00000409</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
@bohack
bohack / Useful Office 365 Blurbs
Created November 12, 2018 15:23
Useful Office 365 Blurbs
Find who or what owns an SMTP address
Get-Recipient -ResultSize unlimited | where {$_.EmailAddresses -like "*buha*"} | FL DisplayName, EmailAddresses
@bohack
bohack / PowerShell to Read the Folders Information
Created October 31, 2018 14:34
PowerShell to Read the Folders Information (Profile Cleanup)
Get-ChildItem y:\ | ForEach-Object {
Get-ChildItem y:\$_ | ForEach-Object {
$Size = "{0:N2} MB" -f ((Get-ChildItem $_.fullname -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB)
$Out = $_.FullName + "," + $_.LastWriteTime + "," + $Size + "," + $_
Write-Host $Out
Out-File -Append -InputObject $Out -FilePath .\output.csv -Encoding ascii
}
}
@bohack
bohack / Example of trapping missing EXEs
Created October 24, 2018 17:14
Example of trapping missing EXEs
@ECHO OFF
REM Bohack
REM 10/8/18
REM Example of trapping missing EXEs
ECHO %ERRORLEVEL%
ECHO.
pslists
IF %ERRORLEVEL% EQU 9009 (COLOR 47 && ECHO. && ECHO ERROR! - Please install PStools from Microsoft. && ECHO.)
@bohack
bohack / Remote GPO Pusher for VDI Problem
Created October 24, 2018 17:13
Remote GPO Pusher for VDI Problem
@ECHO OFF
REM Bohack
REM 10/08/18
REM Remote GPO Pusher for VDI Problem
IF {%1}=={} (ECHO. && ECHO %0 computername && ECHO. && GOTO :END)
WMIC /node:%1 process call create "CMD.EXE /C GPUPDATE.EXE"
TIMEOUT 15 /NOBREAK
PSKILL \\%1 vmware-view
IF %ERRORLEVEL% EQU 9009 (COLOR 47 && ECHO. && ECHO ERROR! - Please install PStools from Microsoft. && ECHO.)
:END
@bohack
bohack / Deployment Script for TFS to PHP
Created September 11, 2018 16:00
Deployment Script for TFS to PHP
#!/bin/bash
DEPLOYPATH="/var/www/websitea/"
filename=$DEPLOYPATH'rwpermissions.txt'
echo Start
while read p; do
echo runner=$DEPLOYPATH$p
runner=$DEPLOYPATH${p/$'\r'/}
chmod -R 0666 $runner
chcon -v -R --type=httpd_sys_rw_content_t $runner
@bohack
bohack / Nexus ACL Objects Example
Created August 30, 2018 15:55
Nexus ACL Objects Example
object-group ip address test_hosts
host 10.10.1.151
host 10.10.1.181
object-group ip port test_ports
eq 5000
ip access-list IT-Acad-VDC
permit tcp 172.16.0.0/12 addrgroup test_hosts portgroup test_ports