Thursday, January 4, 2018

Neo Geo offload time!

So this is it.   I'm offloading all my Neo Geo stuff.  It's been a couple of years since I traded in for the AES but the games on there never appealed to me.   Since its still worth a pretty penny, I'm going to sell it off and put the money on expanding my existing PC Engine or Saturn stuff.  Already sold my copy of CyberLip for $300 and got a Saturn Derby Edition.  Sweet!

http://ift.tt/2CIy0x1

Wednesday, January 3, 2018

To find a VM with a particular snapshot name

Get-Snapshot -VM VM -Name '<snapshot name>'


http://ift.tt/2qoXv0T

Power off a Virtual SAN Cluster

Power off a Virtual SAN Cluster

Prerequisites
If the vCenter Server VM is running on the Virtual SAN cluster, migrate the VM to the first host, or record the host where it is currently running.
Procedure

1
Power off all virtual machines that are running on the Virtual SAN cluster.
The vCenter Server virtual machine must be powered off last.
2
Place all ESXi hosts that compose the cluster in maintenance mode.
Run the esxcli command to set the Virtual SAN mode for entering the maintenance state.
esxcli system maintenanceMode set -e true -m noAction
3
Power off the ESXi hosts.

Bare metal recovery for Windows 2012 from a Windows Server Backup image.

Bare metal recovery for Windows 2012 from a Windows Server Backup image.

  1. Create an ISO of the backup image and mount it to VM.
  2. Install a fresh OS
  3. Install vmware tools.
  4. Reboot into Windows install ISO.
  5. Select System Image Recovery
  6. Select the command prompt.
  7. Type in "start /w wpeinit"  to enable the network and get an ip.
  8. Exit the command prompt.
  9. Select System Image Recovery.
  10. Select the Operating System.
  11. Select the "Select a system image" radio button and next.
  12. Click on the "Advanced.." button.
  13. Click on "Search for a system image on the network"
  14. Type in the path of the backup.  Make sure its the path that has the "WindowsImageBackup" folder or it will not detect an available image.
  15. Type in your credentials.
  16. Select the backup from the list and click Next.


http://ift.tt/2CBqx23

Disable IPv6 via commands in Windows

get-netadapterbinding
set-NetAdapterBinding -Name “Network Adapter Name” –ComponentID ms_tcpip6 –Enabled $False

new-itemproperty -Path HKLM:\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters -Name DisabledComponents -PropertyType DWord -Value ffffffff
http://ift.tt/2lPOBDQ

Get all properties of the file in powershell.

 Get-Item -Path c:\myfile.txt | format-list -Property * -Force
http://ift.tt/2CBzkBe

Tuesday, January 2, 2018

Write to a file in CSharp

Quick and dirty way to write to a file in C#.

StreamWriter log = new StreamWriter(@c:\log.txt);
log.WriteLine(ErrorMessage);
log.WriteLine();
log.Close();

Setup iptables in Linux

Ubuntu does come with iptables preset like in Fedora. Here's the base set up for iptables.

Add iptable rules.

Block Null Packets
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP

Reject Syn-Flood Attack

iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP

Reject XMAS/recon packets

iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP

Allow custom ports
<here>

Accept Established Connections

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A INPUT -j REJECT iptables -A FORWARD -j REJECT

iptables -A FORWARD -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

iptables -A FORWARD -j REJECT

iptables -A OUTPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

Use iptables-save to save it to a file.
iptables-save > /etc/iptables.rules

Edit rc.local to import iptables rules during boot up.
iptables-restore < /etc/iptables.rules

Get VMX and VMWare tools version and export to CSV

To get the VMware tools versions and export it to a csv called vmtools.csv

get-vm | where {$_.powerstate -ne "PoweredOff" } | where {$_.Guest.ToolsVersionStatus -ne "guestToolsCurrent"} | % { get-view $_.id } | select Name, @{ Name="ToolsVersion"; Expression={$_.config.tools.toolsVersion}}, @{ Name="ToolStatus"; Expression={$_.Guest.ToolsVersionStatus}} | Export-Csv -NoTypeInformation -UseCulture -Path d:\vmtools.csv

Tarball an entire Linux system

#!/bin/bash
#Version: 1.0
#Description:  Checks for a destination mount directory.  Mounts it if it does not exist, the backs up the server to the mount directory.

mountdir="<mount directory>"
servername="<servername>"
exclusions="--exclude=/mnt --exclude=/proc --exclude=/lost+found --exclude=/tmp --exclude=/media --exclude=/sys --exclude=/dev --exclude=/run --exclude=/var/cache"

if [ -d $mountdir ]; then
     cd $mountdir
     tar -zcpf $servername-full-backup-`date '+%d-%B-%Y'`.tar.gz / $exclusions
else
     sudo mount -t cifs -o username=moatisuser,password=moatisuser,rw \\\\fw24\\ata_1 /mnt/fw24
     cd $mountdir
     tar -zcpf $servername-full-backup-`date '+%d-%B-%Y'`.tar.gz / $exclusions
fi