Arcade Cabinet – by request

20140718_083456[1]some people were asking so I snapped a quick pick about my toy.

New Desk!

20130807_230000

20130801_181702

PowerShell – Format this!

So I was at my monthly powershell script club working out how to format a text file. I did it the hard way ahead of time, using excel to move columns around and concatenate stuff. Then I used notepad++ to do the fiddly bits with the specific spaces and column spacing required. (Don’t ask, its for ingestion into a VERY old system)

I showed the guys the file format I get sent to me, then I showed them an example of the file output. Here’s the magic we came up with. Keep in mind they wanted me to condense this down to one line, but I’d rather keep it expanded so I can steal bits of it later. (yes, they gave me permission!)

This file takes in a file as an array, adds headers (not needed, but nice for get-member on the $data variable). The format command then parses the data and formats it to the correct places, finally outputting the formatted array to a text file.


$data = Import-Csv -Header 'account',"usage","sign","ConcatAddress" -Delimiter "`t" "c:\somefolder\messedupfile.txt"

$format = ' {0,-10:D10}{3,-36}{1:D9}{2}'
$output=foreach ($line in $data)
{
$format -f [Int64]$line.account,[Int64]$line.usage,$line.sign,$line.concataddress}
$output | Set-Content 'C:\somefolder\formated.txt'

Hey, see where I used “a” and sometimes ‘a’? turns out powershell doesn’t care which you use so long as the open and close quote style match.

Sysadmins – uptime

this is funny. you really need to read this: Dedication

Server Core Hyper-v Switch removal – The PowerShell Way!

So I’ve been playing with server core for few days now. I’m really starting to get the hang of the interface. I did however, goof something up. I accidentally created a virtual switch on the wrong NIC. I still think the way MS assigns the NICs is silly. the NICs are labled 1-4 on the box, but MS just seems to randomly pick adaper numbers. Probably not random, I just don’t know the answer. thats for another blog post, I suppose.

Regardless, I found myself needing to remove that virtual switch. Turns out someone smart figured out how to do that. Roger Johnson found a way to make it happen. In a nutshell, he found a way to create an object reference to the WMI class “MSVM_VirtualSwitchManagementService”. Very cool! anyway, here’s the steps. basic even for those of us who need a complete walkthrough:

1. download the hyper-v module. you’ll need that for the commands to function. You can download from Codeplex

2. right click on the .zip file and unblock it. then move it to your server. I use a network mapped drive that I can access from my server. Copy the file to where the rest of your modules are:
c:\Windows\System32\WindowsPowerShell\v1.0\Modules

3. Check to make sure powershell can find it. open powershell from the command prompt by simply typing “powershell”. Then enter the command

Get-Module -list

4. Import the module.

import-module HyperV

Now the fun stuff. the POWERSHELL!

Set your execution policy to unrestricted for this session.

Set-ExecutionPolicy Unrestricted

Create a variable and set it equal to that WMI class
$HVSwitchObj = Get-WMIObject –class “MSVM_VirtualSwitchManagementService” –namespace “root\virtualization” –computer “.”

Select the virtual switch to be deleted. Again we create a variable for that

 $HVSwitch = Choose-VMSwitch

Then delete that offending switch!

$HVSwitchObj.DeleteSwitch($HVSwitch)

GONE! fun. right? any props should go to Roger Johnson. he put the hard part together. I just added some of the basic stuff at the begining.

Server 2008 R2 Core

So, I finally have moved into a realm where I want to squeeze as much power out of my new servers. My latest purchase is a nice Dell 710 with a boat load of ram in it. I want that to be my hypervisor managing only the network connections. LOW OVERHEAD. That sounds great to me. Trouble is, I’ve never acutally configured a server without a GUI. I’ve dabbled in powershell and I’ve done plenty of unix/linux work from the command line though. How hard can it be?

Very, it turns out. I’m having a lot of inconsitent problems. I had no problem installing the OS. that went fine. I was even able to find plenty of documentation out there on, but not limited to Microsoft’s site. But I’m having strange problems I can’t find answers to.

The biggest is that I can enable remote desktop (can we really call it that in core? its just a command line prompt) but I cannot remotely access the event viewer, Hyper-v or disk managment…. I’ve configured it to do so.

first I found the sconfig command.

sconfig

That allowed me to “enable” remote access, turn on and install updates and powershell access. RDP seems to function fine. No other functionality is working. with Hyper-v I get RPC connection errors and network path not found with the remote computer managment.

the odd part is this: i removed the computer from the domain, re-added it and then I had access. This was late at night so I called it a win and went home. The next day I got back and there is no connection. restarted the server (its not in production yet) and still no love? what changed?

More as I work this out……

Update:

I spoke with my friend Steve who pointed out that I may be having firewall issues. so I turned it off!

netsh advfirewall set allprofiles state off

Totally worked. I suspected as much, but think my settings aren’t sticking. What could cause this to happen? without me making any changes? GPO!!! (thanks again Steve, good to have friends.)

So I poped open my Group Policy Managment, looked up my server and the GPOs that are applied to it. Turns out there is a firewall policy applied to EVERY computer in my network. Upon inspection I see that there is a section that “allow inbound remote administration exception”. The question is this, “is this policy over-writting the policy in place or is it appending?” I’d think over-writting due to my funny errors. The policy itself is only set to enable remote access. Since I am enabling the policy, does it require that I explicitly set the rules for all the remote access? good question! I disabled the GPO that was setting some firewall options. Restart on the server to get the new GPO setup and viola, connections are working fine. the GPO was interfering. I’m a bit suprised, and now I have a bunch more work to get my GPOs set to provide what that old GPO did without messing up my new systems.
After all the basics got ironed out, I then found a nifty tool for configuring core installations. called Core configurtor 2.0 you can find it here
Core configurator 2.0
Make sure to copy it to a tools folder on your C:\
then you can run it by typing

cscript Start_Coreconfig.wsf

This tool gave me the ability to use a GUI to set some of the things I needed done. I did google for each command I was going to need and entered them one at a time. That’s the hard way. Done that, time for something easier.

OpenFiler – Volume size over 2 TB

Go to “Volumes” and then “Block Devices”. For your 4TB volume, what is the label type? If it says “msdos”, as I said, you cannot have a “msdos” partition table and use more than 2TB. If it says “gpt” then you may have hit upon a bug.

If it says “msdos” then do the following:
– Remove any volumes, volume groups, physical partitions, etc. that you created on that disk.
– Open a command prompt
– Run “parted /dev/sda” (substitute the appropriate device name)
– Type “print” (you should see the total size of the disk and the label type)
– Type “mklabel gpt”
– Type “print” (to make sure that the label has changed)
– Type “q” (to quit)
– Close the command prompt

Back in the web admin, refresh the “Block Devices” page and see if it now shows a label of “gpt”. If it does, create your physical partition, volume group, etc. If it doesn’t, reboot.

Dell PowerVault – Reclaiming space

This command will make all space on diskgroup 0 contiguous

navigate to the following ( make sure you have the dell powervault client software installed)

c:\program files (x86)\Dell\MD Storage Manager\client

smcli -n gfpdiscsi01 -c “start diskGroup [0] defragment;”

Microsoft Lync 2010 install

new project! I’ve been working on installing lync 2010 in my environment. Here’s some prelim notes. I’ll update as I go.

Running the Console:

I attempted to launch the console both with the start menu link directly on the server and by going to https://servername/cscp

both gave me the following error.

Could not load type System.ServiceModel.Activation.HttpModule

What it boiles down to was that the IIS server was installed AFTER  .net  framework 4. The fix is simple. re-register aspnet and IIS.

aspnet_regiis.exe -iru

Adding users:

You cannot add users via the console who already belong to the domain admin’s group. You’ll have to do it via powershell. To make it easy – for those of us who are new at powershell – you can use the Lync Server Management Shell right in the start menu.

Enable-CsUser -Identity "User Name" -RegistrarPool "Name.of.your.server"
-SipAddressType SamAccountName  -SipDomain "domain.local"

Please note that you can change the SamAccountName to use whichever method you like to generate sip address type. the ref link below has options.

Reference:technet.microsoft.com/…/gg398711.aspx

Dell Powervault – Host groups and shared virtual disks

I learned something today! That makes it a good day, and its only 8:30am.  A while back I stood up a new virtual server. I have a few of them and they all use my Dell Powervault to hold the VM files. This works well for a number of reasons. The powervault and servers use their own gigabit LAN to transfer data. Nice and fast. The powervault is fault tolerant, so I sleep better at night.  I tried something new this time though. I created a host group, consisting of two virtual machine hyper-visors. I gave them both access to the same virtual disk. All was well for a while. then one of my servers got itself corrupted. (see my previous post about backing up servers!) Then another got corrupted. The second hyper-visor couldn’t even see the virtual disk anymore even with a bunch of fiddling. That’s tech-speak for troubleshooting until my eyes bleed.

After a lengthy call with Dell’s customer support I found out that even though their documentation shows you how to share a virtual disk between computers, DON’T DO IT. Apparently this can and does cause disk corruption because Microsoft doesn’t play well when sharing a file system. Supposedly I can only get away with this if I had the two hyper-visors clustered. Which I don’t.  Any way, something new!

Return top