Graeme Bray

Real World Automation and Deployment

PowerShell should change your documentation method

leave a comment »

I’ve been doing a lot of documentation lately for some new infrastructure type of deployments. I’ve been documenting how to install and configure different Microsoft services to save for our internal documentation. (If you’re not doing this…get with the program). I’m still taking screen shots of how to do everything with text blurbs. It takes forever to do this. I’ve been putting at the end my powershell commands on how to do it.

For example…

I am working on building a DFS Cluster with File Shares. My steps were documented almost entirely via PowerShell. Yes, we still take screenshots and document what the command does so people can learn, its better than the GUI.

Install-WindowsFeature Failover-Clustering -IncludeManagementTools
Install-WindowsFeature -Name FS-DFS-Replication -IncludeManagementTools
Install-WindowsFeature -Name FS-Resource-Manager -IncludeManagementTools
New-Cluster -Name DFSCLUSTER -StaticAddress -Node -NoStorage -Verbose
Get-Cluster -Name DFSCLUSTER | Add-ClusterNode -Name
Get-ClusterAvailableDisk | Add-ClusterDisk -Verbose
Set-ClusterQuorum -NodeAndDiskMajority 'Cluster Disk 1' -Verbose
get-adcomputer -identity DFSCLUSTER | Set-ADObject -ProtectedFromAccidentalDeletion:$false

I just built a 2 node cluster (granted I have no error checking) in about 5 minutes. Server is online and ready to have an application installed, assuming that you have no issues with Firewalls or Virtualization.

The second step of a HA DFS Cluster is to create the File Server Role. This is a single Powershell command. I didn’t *bother* to create documentation for this in the GUI.

Add-ClusterFileServerRole -Name DFSSVR -Storage 'Cluster Disk 2' -StaticAddress -Verbose

Finally, I am also working on creating documentation for how to create a new Share on this Server 2012 R2 cluster. I’ve got a 24 step process on how to create a share properly via the GUI.

I also have a 4 line Powershell command (names obviously obfuscated)

If (!(Test-Path 'D:\Graeme')) {
    New-Item 'D:\Graeme' -ItemType Directory

New-SmbShare -Name 'Graeme' -Path 'D:\Graeme' -ContinuouslyAvailable:$true -FullAccess 'Everyone' -CachingMode None -ScopeName DFSSVR -EncryptData:$false -FolderEnumerationMode AccessBased

I haven’t figured out how to perform the NTFS permissioning (So please feel free to assist. The Get-ACL and Set-ACL commands seem to require some investigation and playing with).

If you haven’t started documented and building everything in Powershell, you’re late to the party.


Written by Graeme

September 15, 2014 at 3:17 AM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: