travis' brain dump

Tech Stuff

Get BlockSize of Disks Using WMI & Powershell

by on Apr.12, 2017, under Tech Stuff

Ok, so I couldn’t find this earlier on the web easy enough, so I figured I’d stick it here for later if I ever need it again. I was trying to verify that my scripts had correctly formatted the volumes for SQL data with the correct block size. This should come in handy for anything else you need to verify block size with as well. 

$WMIQuery = “SELECT Label, Blocksize, Name FROM Win32_Volume WHERE FileSystem=’NTFS'”
Get-WmiObject -Query $WMIQuery -ComputerName ‘.’ | Select-Object Label, Blocksize, Name

Leave a Comment more...

Installing ADFS to Server Core (2016)

by on Oct.03, 2016, under Tech Stuff

This post assumes you have already completed your installation of Windows Server 2016 and configured IP addressing, domain join, etc.
(* this can easily be accomplished by running ‘sconfig.cmd’ when you first login so it’s not worth a full post)

To get started, login as a domain administrator for the system and complete the following commands on the prompt presented:

– ‘powershell’
– ‘Install-WindowsFeature ADFS-Federation’

This should install all necessary feature related items for ADFS on the system.

Another key component will be your SSL cert. Whatever you will be using, preferably a certificate for or *, I recommend you export it out with private key in PFX format. Once completed, you’ll need to make sure you copy your certificate pfx out to the machine(s) and then execute the following:

– ‘certutil -importpfx <Path to certificate file>’

You can confirm your certificate installation and snag the thumbprint by executing the following:

– ‘dir cert:\LocalMachine\My’

If you’re setting up the first machine in a farm execute the following commands:

(this method uses a domain user/service account):
– ‘$ADFSCred = Get-Credential’ (input the credentials for your service account) 
– ‘Install-AdfsFarm -CertificateThumbprint:<thumbprint> -FederationServiceDisplayName:”Test Lab” – FederationServiceName:”” -ServiceAccountCredential $ADFSCred -OverwriteConfiguration’

(this method used a group managed service account (the $ is required): 
– ‘Install-AdfsFarm -CertificateThumbprint:<thumbprint> -FederationServiceDisplayName:”Test Lab” – FederationServiceName:”” -GroupServiceAccountIdentifier <DOMAIN>\<serviceaccount>$ -OverwriteConfiguration’

Additionally if you want to allow for logins using an email address as username, run the following:

– ‘Set-AdfsClaimsProviderTrust -TargetIdentifier “AD AUTHORITY” -AlternateLoginID mail -LookupForests’

This should get the initial setup of ADFS running for you on the main machine. 

To add additional machines to the farm (up to four using WID) you install all features, SSL certificate, etc. however, instead of installing the farm, you will add a node. You will execute this from each member node you wish to add, assuming SERVER1 is the name of the initial ADFS instance you setup and you’re running this on SERVER2.

(this method uses a domain user/service account):
– ‘$ADFSCred = Get-Credential’ (input the service account credentials you listed above)

– ‘Add-AdfsFarmNode -ServiceAccountCredential $ADFSCred -PrimaryComputerName SERVER1 -CertificateThumbprint <thumprint> -OverwriteConfiguration’

(this method used a group managed service account (the $ is required): 
– ‘Add-AdfsFarmNode -GroupServiceAccountIdentifier <DOMAIN>\<serviceaccount>$ -PrimaryComputerName SERVER1 -CertificateThumbprint <thumprint> -OverwriteConfiguration’

You should see a success message. If you do not, you can troubleshoot by testing out the farm configuration with the following commands:

– ‘$ADFSCred = Get-Credential’ (input the service account credentials)
– ‘Test-AdfsFarmJoin -ServiceAccountCredential $ADFSCred -PrimaryComputerName SERVER1’
*** If you plan on migrating from 2012R2 to 2016, you will need to set your newly installed 2016 secondary as a primary. 

From  your secondary box, run the following command: 
Set-AdfsSyncProperties -Role PrimaryComputer

You can then run the following to check it’s role: 

If you have other secondary machines, make sure to update their configuration to point to the new primary: 
Set-AdfsSyncProperties -Role SecondaryComputer -PrimaryComputerName <FQDN of ADFS Primary Server>

Once you’ve verified your new machine is running primary, you remove the old instances from the farm with Remove-ADFSFarmNode. 


Leave a Comment more...

Disk Cleanup Utility on Win 2008 R2

by on Jul.06, 2016, under Tech Stuff

Ok, so the convenience of using the disk cleanup utility is sometimes nice for a quick cleanup of service pack files, etc. But it’s missing on 2008 R2. What a pain.

Two ways to get this:

  1. Install the desktop experience. Not the best route as this installs all kinds of stuff you don’t want on your server but it works.
  2. Manually copy the files from that overgrown beast that is WinSxS (finally something it’s good for) and run the utility directly. (my preference)

To install, copy the following files to the correct destination:

  • cleanmgr.exe
    • copy from: c:\windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe
    • copy to: c:\windows\system32
  • cleanmgr.exe.mui
    • copy from: c:\windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui
    • copy to: c:\windows\system32\en-us
  • Install the following update:¬† (reboot may be necessary)


Leave a Comment more...

Vera Scene/Device Mode Manipulation

by on Feb.11, 2016, under Tech Stuff

Anyone who’s into home automation with Vera devices, this is for you. Just filing this one under ‘random things I don’t want to forget’.

Use this Luup code in a scene to modify your home mode on an action. For instance, you come inside or wake up in the morning and disarm your alarm but want the home mode to change from Night, Away, etc to Home.

luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1″,”SetHouseMode”, {Mode = value}, 0)

Where Mode = value, value = 1 – Home, 2 – Away, 3 – Night, 4- Vacation

ex Scene Configuration:

Step 1 Trigger – ‘Vista Alarm is DISARMED’
Step 2 Device Actions – Leave Empty
Step 3 Finish the Scene – Use the provided code under the section ‘ Also, execute the following Luup code:’
luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1″,”SetHouseMode”, {Mode = 1}, 0)

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!