Category: Work

Day job related.

List of Roles and Features – Windows 2012

Need a quick list of currently installed roles and features on your Windows 2012 server?  Open a PowerShell prompt and put in the following:

Get-WindowsFeature -ComputerName COMPUTERNAME | Where-Object InstallState -eq Installed > installed.txt

It’ll give you a list similar to this:

Display Name                                            Name                       Install State
------------                                            ----                       -------------
[X] File and Storage Services                           FileAndStorage-Services        Installed
    [X] Storage Services                                Storage-Services               Installed
[X] Web Server (IIS)                                    Web-Server                     Installed
    [X] Web Server                                      Web-WebServer                  Installed
        [X] Common HTTP Features                        Web-Common-Http                Installed
            [X] Default Document                        Web-Default-Doc                Installed
            [X] Directory Browsing                      Web-Dir-Browsing               Installed
            [X] HTTP Errors                             Web-Http-Errors                Installed
            [X] Static Content                          Web-Static-Content             Installed
        [X] Health and Diagnostics                      Web-Health                     Installed
            [X] HTTP Logging                            Web-Http-Logging               Installed
        [X] Performance                                 Web-Performance                Installed
            [X] Static Content Compression              Web-Stat-Compression           Installed
        [X] Security                                    Web-Security                   Installed
            [X] Request Filtering                       Web-Filtering                  Installed
        [X] Application Development                     Web-App-Dev                    Installed
            [X] .NET Extensibility 4.5                  Web-Net-Ext45                  Installed
            [X] ASP.NET 4.5                             Web-Asp-Net45                  Installed
            [X] ISAPI Extensions                        Web-ISAPI-Ext                  Installed
            [X] ISAPI Filters                           Web-ISAPI-Filter               Installed
    [X] Management Tools                                Web-Mgmt-Tools                 Installed
        [X] IIS Management Console                      Web-Mgmt-Console               Installed
[X] .NET Framework 3.5 Features                         NET-Framework-Features         Installed
    [X] .NET Framework 3.5 (includes .NET 2.0 and 3.0)  NET-Framework-Core             Installed
[X] .NET Framework 4.5 Features                         NET-Framework-45-Fea...        Installed
    [X] .NET Framework 4.5                              NET-Framework-45-Core          Installed
    [X] ASP.NET 4.5                                     NET-Framework-45-ASPNET        Installed
    [X] WCF Services                                    NET-WCF-Services45             Installed
        [X] HTTP Activation                             NET-WCF-HTTP-Activat...        Installed
        [X] Message Queuing (MSMQ) Activation           NET-WCF-MSMQ-Activat...        Installed
        [X] Named Pipe Activation                       NET-WCF-Pipe-Activat...        Installed
        [X] TCP Activation                              NET-WCF-TCP-Activati...        Installed
        [X] TCP Port Sharing                            NET-WCF-TCP-PortShar...        Installed
[X] Enhanced Storage                                    EnhancedStorage                Installed
[X] Message Queuing                                     MSMQ                           Installed
    [X] Message Queuing Services                        MSMQ-Services                  Installed
        [X] Message Queuing Server                      MSMQ-Server                    Installed
[X] SMB 1.0/CIFS File Sharing Support                   FS-SMB1                        Installed
[X] User Interfaces and Infrastructure                  User-Interfaces-Infra          Installed
    [X] Graphical Management Tools and Infrastructure   Server-Gui-Mgmt-Infra          Installed
    [X] Server Graphical Shell                          Server-Gui-Shell               Installed
[X] Windows PowerShell                                  PowerShellRoot                 Installed
    [X] Windows PowerShell 4.0                          PowerShell                     Installed
    [X] Windows PowerShell 2.0 Engine                   PowerShell-V2                  Installed
    [X] Windows PowerShell ISE                          PowerShell-ISE                 Installed
[X] Windows Process Activation Service                  WAS                            Installed
    [X] Process Model                                   WAS-Process-Model              Installed
    [X] Configuration APIs                              WAS-Config-APIs                Installed
[X] WoW64 Support                                       WoW64-Support                  Installed

To view in the prompt rather than dumping to a txt, remove the

> installed.txt

Wireless instability

I upgraded to a (hand me down) Dell Latitude E6530 not long ago.  I loaded it with Windows 8.1 (and Classic Shell, because one must).  I kept having wireless trouble – dropping off of networks.  It wasn’t isolated to my home.  What I believe I’ve determined is that, in a nutshell, Windows handling of N networks kind of sucks.  I disabled N and since then have been rock solid.

Navigate to your network adapters, right click on the wireless and choose Properties.  Beneath the adapter description choose Configure:

one

Choose the Advanced tab, then locate 802.11n Mode.  Switch the Value to Disabled and OK  your way out of all.

two

Wherein the Young IT Guy becomes the Old IT Guy

I had installed and configured a trial of a web analytics package for my day job and had the server put through the wringer.  Among the issues found was a redirect buried deep in the code to cornify.com, “…the #1 unicorn and rainbow service worldwide, spreading sparkly happiness around the world.”  I added it to my list of concerns for the products developers and shipped it to them.  They responded that the cornify link was an “Easter Egg” put there by one of the coders  and wasn’t a security concern.

My immediate thought was this:  What if cornify becomes something else?  What if it stops being the #1 unicorn and rainbow service worldwide?  What if someone buys the name, or hijacks it, and it instead leads to an unsavory site?  How will you explain to your paying customers that you’re rushing out an update to the web app they’ve paid you handsomely for, and that their administrators need to burn their time updating it ASAP, because a redirect you added on a whim now points to something lawsuit inducing?  Less dramatically, and more likely, why would you want to deal with that inevitable customer  who gave you thousands of dollars for your product and doesn’t have a sense of humor?  The one who thinks it’s completely unprofessional and a poor reflection on them that your product did what you think is a lighthearted redirect?  Is being clever (and let’s be fair – it’s not all that clever) worth that risk?

And that’s when I realized I’d stopped being the Young IT Guy and I’d become the Old IT Guy.

 

Resizing a VirtualBox VDI

Expanding drive space in VirtualBox has gotten easier!  Just clone the VDI (this step isn’t required, but if something goes wrong you’ll be happy you did it), then zap the clone with this:

VBoxManage modifyhd <absolute path to file> --resize <size in MB>

Fire up the clone.  If you’re running a modern Windows OS you can use Disk Manager to expand the partition to fill the volume.  Otherwise check out gparted.

 

Avaya One-X Error Saving Preferences.xml

I use Avaya One-X for work.  I got the above error this morning.  I couldn’t find a resolution via Googling, and Avaya’s support is notoriously sucky.  BUT, I did find out what the purpose of Preferences.xml is.  It keeps settings like window positions.  Bearing that in mind, I figured before reinstalling I’d try blowing it away (renaming it, actually) to see if it would recreate.  It did, and the app came up fine.

Preferences.xml is located in

%APPDATA%\Avaya\one-X Agent\2.5\Profiles\[Profile Name]

on Win7/8.

Rebuilding Workstation Tips

New hard drives have arrived for my workstation and laptop.  They’re desperately overdue for a rebuild.  I love rebuilding and I hate it.  I love it because newly built machines run so smoothly, so cleanly, and have that new-machine smell.  It’s like virtual spring-cleaning.

I hate rebuilding because there’s so much stuff on my machines.  I’ve done a better job over the years of compartmentalizing (and even backing up) my data, but there’s still a lot of it – more than I’d like.  And the applications.  I use so many applications!  Every rebuild I think “I don’t need 3/4 of these apps.  I’m not putting them back on.”  But eventually, inevitably, as I work on this and that my installed app list grows, and I find myself installing a significant amount of the apps I insisted I wouldn’t.  Such is the curse of the breadth of things I work on, I suppose.  Just this morning a coworker from a completely different department commented that I’m the bitch for my department.  I work on whatever needs working on.  My boss generously calls me his “tool belt.”  Bitch is, honestly, more accurate.

Anyway, here are a few things that make my rebuild process less arduous.

  • I always build fresh onto new drives, holding onto the old ones.  Drives are cheap.  There’s nothing worse than blowing your drive away, rebuilding, and suddenly remembering something of Significant Importance™ that you forgot to back up.  Don’t sweat that.  Take the time to decrypt your current drives (you do encrypt them, don’t you) and set them aside. Build on a new drive, and keep your old ones around for a few weeks just to be sure.  Then you can wipe them and use them as scratch drives or external storage or replacement drives for that friend whose drive craps out or whatever.
  • Make a list of your installed applications.  It’s easy:
  1. Open a command prompt with elevated rights (Start > Run > type in CMD.  When the CMD icon appears, right click and Run as Administrator).
  2. Type in WMIC.
  3. Type in /output:c:\path\to\installed_list.txt product get name,version where path\to is, well, the path to wherever you want to write your installed_list.txt.
  4. Wait for it to finish. Enjoy list of apps.

I’ll add more to my list as my latest rebuilds commence.

Remote Software Scanner

I was writing a script that would scan remote Windows systems and return their installed software, complete with version information (a requirement), and quickly discovered that the process was more arduous than I had originally anticipated.  How to pull it?  WMI?  Use PowerShell?  Glean the information from the registry?  I fiddled with each and, given that I was working with a broad array of OS levels and a mix of 32 and 64 bit, each option had its annoying pitfalls.

Sometimes it’s better to let someone else do the work.  This is one of those times.

I found the EMCO Network Software Scanner, which does exactly what I need and much more, and amazingly enough is also free!

So much props to EMCO.  I’ll be keeping their commercial products in mind down the road.

Sending an email with Task Scheduler using Powershell

Today at work I had a need to query a bunch of databases for a particular, er, thing, and then send that thing, if found, to myself via email.  I needed this to happen every morning. I decided, since we’re talking about a MS SQL and Windows 2003/2008 environment, that Powershell was the way to go.  And it was – until I popped it into scheduler.

When executed as a scheduled task, the email didn’t send.  Things before and after the email routine worked – the arrays populated, the log file filled – but the email didn’t go.  Firing it from a Powershell manually, everything went fine.

Being the stubborn arse I am, rather than get to Googling I started ripping things apart.  I had the query dump its results into a temp file that a separately scheduled script would open, parse, email and then clear.  Same result: run manually everything worked peachy. Scheduled, no email.

In the end the problem was irritatingly simple.  For some reason, when run as a scheduled task the script didn’t keep the socket open to the SMTP server long enough for a successful transmission.  I added a Start-Sleep -s 5 right after the SMTP command to give it a 5 second breather before continuing on.  Voila – email success.  How silly.

I think I’m going to like Powershell just fine.  Other than quirks like this, and getting used to the syntax, it’s easy enough – and it seems a lot of Windows specific stuff is streamlined, at least in comparison to my old go-to admin scripting languages.