List all shares with Everyone having FullControl access

Ever wonder how many users grant full control to Everyone on shares they created? This opens a huge risk, as any virus/worm can write itself to these shares, given the NTFS permissions allow them as well. At any rate, I don’t think it’s a good idea, so I scripted it out and found something like 470 shares where Everyone was granted FullControl access in my environment. OUCH!

Continue reading

Automated deployment script builds VM, registers in SCCM

This is a follow-up to my last post about fully automated deployment

Below is the script. After it pulls the information from you, it creates the VM, adds the second disk, sleeps for 15 seconds, pulls the MAC from the new VM, creates the computer object in SCCM, adds it to the collection, sleeps for 15 seconds, refreshes the collection, sleeps for 15 seconds, then powers on the VM. If you’ve got a mandatory OSD advertised to the collection specified, and the OSD is fully automated, it will lay down the OS and the computername will be the name you provided to the script.
Continue reading

PowerCLI + VMware + SCCM = sweetness, aka automated deployment

So I’m creating a script that builds a VM for you, imports the NetBIOS name & MAC address into SCCM, adds it to a specific collection, and then powers on the VM. If you have a mandatory OS Deployment for that collection, you don’t have to do anything but sit back and watch (given your Task Sequence is fully automated).

It prompts you for vCenter name, VM name, cpu, ram, description, disk size, queries vcenter for clusters, networks, datastores (sorted by free space), and verifies with you before building…

I’m excited & pleased that it’s actually working. It’s currently proprietary to my work environment, but I will try to strip all that out and let you change what needs to be changed to use it where you like.

Happy Scripting!!!

PowerShell multithreaded script to recursively search for file types, shows count and total size

I recently had a requirement to build a script that listed all PST files on some of our DFS folders. I know there are a bunch of ways to get this done, but I wanted to build my own way. Since we needed to search roughly 20 directories, I decided to play with the Start-Job cmdlet so I could have one script to spawn multiple worker processes. At first, it was tricky (since I had never even messed with it), but anyone can easily pick it up.

Continue reading

ESXi Auto configuration script

Lets face it, repetition sucks. When provisioning ESX hosts, using such things as the EDA make life easier, but it only does so much for ESXi.

The install for ESXi is simple and straight forward, but when done, you have to go and set everything else (IP, hostname, DNS, local users, etc…). Doing this for 20 hosts could be a PITA (Pain In The A..), so I set out on writing a script that does all of this for you.

All you have to do is set the IP & root password, then verify you can ping the host by it’s hostname (set host/A record in DNS). Once that’s verified, here’s what the script does for you:

  • Creates an Admins group and assigns it to the Administrator role
  • Creates local users, sets their default password, and adds them to the Admins group
  • Sets primary & secondary NTP & DNS servers
  • Sets DNS search suffix
  • Combines the provided hostname with DNS search suffix to populate the hostname FQDN
  • Sets EnableNaviReg to 0, disabled (requested by my storage team)
  • Disables iSCSI (disabled by default, but enabled in my sd image I created from previous post, thus the need to disable)
  • Disabled Tech Support Mode, aka ‘unsupported’ console

This is a slightly more advanced script, and it’s not fully polished, but works. Continue reading

Using PowerCLI to rescan HBA and VMFS v2

I wanted to expand This Script to allow you to specify hosts as well, instead of just vCenter.

This came about because we have 20 new hosts that need storage so we can build our new vCenter server on them, and my old script wouldn’t suffice.

So, without further ado, here’s the updated script: Continue reading

Finding WWNs for HBAs in multiple ESX or ESXi hosts, standalone or clustered

When building a new cluster, your storage team (or you) may need to add several hosts into the shared storage zone. It’s a pain to go to each host, configuration, storage adapters, then copy out the WWN.

With this script, you can supply a vCenter server and Cluster/Folder/Datacenter (any logical container) and it will list all the WWNs for Fibre Channel devices. But what if you don’t have vCenter stood up yet? No problem, you can also supply a list of ESX/ESXi hosts to scan.

Shawn & I built this because we have 20 hosts we need the WWNs from to provide to our storage team, and vCenter isn’t alive yet.

Our script: Continue reading