See who is logging onto your domain

I was looking a migration from one domain to another a short while ago. Almost all the users accounts had been migrated over but there were a few hanging on.

The migration tool wasn’t doing a great job of picking them up so I wrote a small script and added it to group policy for all servers and workstations. Now when someone logs in to the old domain a line is written to the log with their username, computer name and IP address.

Using this the person responsible for the migration can get through the last few people on the old domain. This has saved a lot of time as before I wrote this th eprocess was very manual.


Const ForAppending = 8
Set WshShell = CreateObject("WScript.Shell")
Set WshNetwork = CreateObject("WScript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("\\ServerName.DomainName.TLD\RemainingComputer\log.txt", ForAppending)
objFile.WriteLine WshNetwork.ComputerName & "," & WshNetwork.UserName & "," & GetIpAddress
objFile.Close

Function GetIPAddress
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'")

For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i = LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
If Not Instr(IPConfig.IPAddress(i), ":") > 0 Then
strIPAddress = strIPAddress & IPConfig.IPAddress(i) & " "
End If
Next
End If
Next
GetIPAddress = strIPAddress
End Function

VBScript to arrange files into folders.

A few days ago I was presented with just over seven thousand PDF files. I had waited six weeks for these files so I was in a horrid mood when they arrived in one big batch with just ID’s in the file name. I had no way of processing them by customer.

I had a spreadsheet that had the billing period, the customer name and the bil number in columns A, B and C respectively so I decided to write up a short script to process these files.

Here’s a cut down version with a little bit removed to protect the various companies involved.


Set FSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("D:\Home\Workarea\Invoices_PDF\invoices.xlsx")

' Starting at row 2 because row 1 is used for the column headings.
intRow = 2
strNewParentPath = "ByETB\"
strOldParentPath = "Combined\"
strBasePath = "D:\Home\Workarea\Invoices_PDF\"
Do Until objExcel.Cells(intRow,1).Value = ""
strPeriod = ConvertPeriod(objExcel.Cells(intRow, 1).Value)
strProcessedCompanyName = ConvertCompanyToDirectoryName(objExcel.Cells(intRow, 2).Value)
strFileName = "billno-" & objExcel.Cells(intRow, 3).Value & ".pdf"
' WScript.Echo "Moving " & strOldParentPath & strFileName & " To " & strNewParentPath & strProcessedCompanyName & "\" & strPeriod & "\"

If NOT (FSO.FolderExists(strBasePath & strNewParentPath & strProcessedCompanyName)) Then
WScript.echo "Folder " & strBasePath & strNewParentPath & strProcessedCompanyName & " didn't exist."
FSO.CreateFolder strBasePath & strNewParentPath & strProcessedCompanyName
End If

If NOT (FSO.FolderExists(strBasePath & strNewParentPath & strProcessedCompanyName & "\" & strPeriod)) Then
WScript.echo "Folder " & strBasePath & strNewParentPath & strProcessedCompanyName & "\" & strPeriod & " didn't exist."
FSO.CreateFolder strBasePath & strNewParentPath & strProcessedCompanyName & "\" & strPeriod
End If

WScript.Echo "Copying from: " & strBasePath & strOldParentPath & strFileName & " Copying to: " & strBasePath & strNewParentPath & strProcessedCompanyName & "\" & strPeriod& "\"
FSO.CopyFile strBasePath & strOldParentPath & strFileName, strBasePath & strNewParentPath & strProcessedCompanyName & "\" & strPeriod& "\"
intRow = intRow + 1
Loop
objExcel.Quit

Function ConvertCompanyToDirectoryName (CompanyName)
if CompanyName = "" Then
WScript.Echo "No ETB Name passed to ConvertCompanyToDirectoryName function"
Exit Function
End If

If InStr(1, CompanyName, "DUBLIN") <> 0 Then
CompanyName = "Dublin"
End If

If InStr(1, CompanyName, "LOUTH") <> 0 Then
CompanyName = "Louth"
End If

If InStr(1, CompanyName, "DONEGAL") <> 0 Then
CompanyName = "Donegal"
End If

If InStr(1, CompanyName, "LIMERICK") <> 0 Then
CompanyName = "Limerick"
End If

If InStr(1, CompanyName, "GALWAY") <> 0 Then
CompanyName = "Galway"
End If

If InStr(1, CompanyName, "CORK") <> 0 Then
CompanyName = "Cork"
End If

If InStr(1, CompanyName, "CARLOW") <> 0 Then
CompanyName = "Carlow"
End If

If InStr(1, CompanyName, "KERRY") <> 0 Then
CompanyName = "Kerry"
End If

If InStr(1, CompanyName, "MEATH") <> 0 Then
CompanyName = "WestMeath"
End If

If InStr(1, CompanyName, "KILDARE") <> 0 Then
CompanyName = "Kildare"
End If

If InStr(1, CompanyName, "TIPPERARY") <> 0 Then
CompanyName = "Tipperary"
End If

If InStr(1, CompanyName, "TIPP") <> 0 Then
CompanyName = "Tipperary"
End If

If InStr(1, CompanyName, "LAOIS") <> 0 Then
CompanyName = "Laois"
End If

If InStr(1, CompanyName, "MONAGHAN") <> 0 Then
CompanyName = "Monaghan"
End If

' Replace spaces with under lines.
If InStr(1, CompanyName, " ") <> 0 Then
CompanyName = Replace(CompanyName, " ", "_")
End If

' Replaces / character with nothing.
If InStr(1, CompanyName, "/") <> 0 Then
CompanyName = Replace(CompanyName, "/", "")
End If

ConvertCompanyToDirectoryName = CompanyName
End Function

Function ConvertPeriod (Period)
If Period = "" Then
WScript.Echo "Period passed to ConvertPeriod function is blank."
Exit Function
end If

If Period = "01/01/2016" Then
Period = "Jan2016"
End If

If Period = "01/02/2016" Then
Period = "Feb2016"
End If

If Period = "01/03/2016" Then
Period = "Mar2016"
End If

If Period = "01/04/2016" Then
Period = "Apr2016"
End If
ConvertPeriod = Period
End Function

Gall bladder removal. The whole story. 

Way back in September I went to bed on a normal night after a particularly difficult day at work. I had been working for at least twenty hours and nothing was going right. As I fell into bed a pain in my torso began to build. Within half an hour the pain was so bad I couldn’t lie still. Half an hour after that I was on my feet pacing around the house trying to regain some composure . I have never felt pain like it and with Judo I’ve had some very painful injuries so that’s saying something! The pain was so bad that I actually called my mother to ask her what I should do. Now, I know what you’re probably thinking. Irish man. Call his mother when things go wrong. You would probably be right however. My mother has a great way of thinking through potential medical problems. It probably comes with raring four children and growing up in a family of 11. Either way, I was desperate so would have done anything to make the pain go away. 
Anyway, a few weeks later, I had another very difficult day and when I went to bed the pain hit again. This night I had such irrational thought’s that I even considered just plunging a knife in to the sore area just to try to stop the pain. I know that wouldn’t have improved things. I know that was an incredibly stupid idea but at the time the only thought going through my mind was that something needed to stop the pain. 

A few more nights like this and I knew that I had to get medical intervention. I spoke to my GP and asked him if it was stress related. He didn’t think so and instead sent me for an ultra sound. A few months later and I got the results.
I was told that I had several stones in my gall bladder and as the gall bladder contracted it was pushing these stones into the neck. I won’t go into the whole thing, but I was told that the only solution was to have the gall bladder removed.  
There are a few disadvantages to this. There’s a potential of digestion problems and generally it can cause you to put on some weight. Both potential problems aren’t too appealing to me so I put off getting anything done about this for about two or three weeks.  
Back in early March I had five days of discomfort. It wasn’t bad in terms of pain but I couldn’t eat, I had absolutely no energy and I generally felt unwell. after the five days I was talked into going to the hospital to get it checked out. The doctors explained that it was the gall bladder causing problems and they offered me what they deemed to be an emergency appointment for the following month to have the gall bladder removed.  
That wouldn’t really suit me as I’m starting a new job in April so taking time off at the start of this wouldn’t present the greatest first impression. I therefore decided to go private. On the 12th of March I arranged an appointment for the 21st of March. When the doctor in the Hermatage saw me he booked me in for the surgery on the 23rd of March.  
That’s the background of this story.  
It’s now a week and a half after the surgery and I’m doing absolutely brilliantly. Let me give you a general idea of how it went. 
Firstly, the day of the surgery was interesting. I was in the Hermatage hospital by 9AM. They gave me a private room within a few minutes of arriving and within the first twenty minutes they had asked me to change into the gown, they had taken a blood sample and they had explained the plan for the day.  
After that I was left alone in the room to get comfortable. Every so often doctors and nurses came in to verify information and check the state of my gall bladder. They needed to ensure that there was no inflamation or other potential problems before beginning the surgery.  
A few hours later two nurses came down to tell me the surgeon was ready. They asked me to lie on the bed to be transported down. I hate that though. I find it very disorientating. Once I can get there on my own, that’s what I’m going to do. So, as they wheeled the bed down, I grabbed onto one side and followed along. They thought I was a bit strange I think as most people would be happy to just take the easy way.  
We got to the operating theatre and again, they asked me the same questions a few times. Name, date of birth, address, procedure and doctors name. Like before, they also checked both identification bands on both my wrists to ensure all the information matched.  
I was finally allowed to go into the theatre. The doors on the way in were very large electronic sliding doors. The floor was very smooth and the air was actually a little cool. From what I could gather, the room was very large with a lot of electronic fans for cooling equipment. There was very little noise within the room other than this quiet hum. I was led over to a very narrow bed that was up at chest height. The sheet on it felt like thick paper. The mattress was minimalist and the frame was thin metal with plenty of electronics below it. Obviously I didn’t have a lot of time to explore the room but instead of being nervous, I found myself very curious about the technology in the room.  
They decreased the height of the bed so I could get onto it. When I lay down I was instructed to shuffle over slightly to my right so I was centered. Once that was done, an anesthetist on my left and his assistant on my right got to work. The man on my left put in the line. This went into my left arm at my elbow. The man on my right strapped a blood pressure monitor to my arm and put an oxygen tester on my index finger. As this was happening, the man on my left asked me to pump my fist a few times. Then the man on my right moved a solid side into position. This enclosed the right side of the bed perfectly so that my right side was securely leaning on it. The man on my left was mean while pumping some kind of drug into my system. This caused me to feel cold and light headed. While this was happening I could hear the static of a large electronic instrument right above me. When all of this was done the person to my right held a mask that smelled of clean plastic over my face. I was becoming groggy so without thinking I put my hand up to feel what I could smell.The person on my left was placing something over my legs and he put my hand back down by my side. I don’t remember a single thing after this until I woke up after the surgery.  
When I woke up I could hear the blood pressure monitor on my right buz to life and soon after I felt the squeeze on my arm. It kind of reminded me of a friend of mine who tightly grabs my forearm when he’s saying hello. At the same time a female voice to my left asked me how I was. In a very cheery voice, I happily responded that I was fantastic. I followed this up by asking her how her day was. Hahahaha. It is funny thinking back on it. I hadn’t yet figured out that I was just waking up and my first answer to her was still in auto pilot. “I’m fantastic! How are you keeping? Are you having a good day?” 
Anyway, nothing interesting happened after that. I was left there in the recovery room under close supervision for about 45 minutes. They then wheeled me back to my room. I had absolutely no problem staying in the bed at that stage! 
I felt incredibly weak for the remainder of the day after the surgery. Even pouring a glass of water seemed too much for me to handle. Fair play to the nurses and doctors though. They couldn’t have been more attentive.
My parents came up that night. I have never been as appreciative to have visitors before! Having people there who can see makes such a difference! I consider myself to be very independent but before the surgery I didn’t feel comfortable enough in the environment to independently explore the room. There were too many people just checking in and asking a lot of questions. After the surgery there was no way I could have explored independently. I wasn’t actually that bad. I was able to get up and walk about three hours after the surgery but I was a bit disorientated so needed a bit more help than normal. When my parents arrived at around 8PM they went over and sat on a couch. I didn’t know there was a couch there. I was just delighted to hear this! Lying in the bed for so many hours was uncomfortable so sitting up right was a nice temporary reprieve. I also didn’t know there was a fridge in the room, there was also another reclining chair and a locker that I could leave stuff in. Even something as simple as plugging in my phone. The sockets were up just above head height. There was no way I would have found them independently at the best of times! Never mind after surgery! 
I told Emma, my wife that she wasn’t to visit. With two kids it wasn’t practical for her to come up. There was no need as I was only in hospital for one night. 
Moving on, the night of the surgery I didn’t sleep much at all. I just couldn’t get comfortable. I also think I had slept too much after the surgery so simply wasn’t tired. I got up and sat on the couch for a few hours listening to podcasts and some training material that I want to study over the next few weeks. I also had a lot more energy so went exploring around that are of the hospital. 
That morning the doctor in charge of the night shift called in at 6AM to check the bandages and all that kind of thing. I was checked again by another doctor at 8AM and just before 9 I was checked a third time by the surgeon. As everything went as well as expected, I was discharged and home just before 11.  
That day came and went. I spent almost all of it in bed either a sleep or just taking it easy listening to podcasts, training material and interesting ted talks on Youtube. Sleeping that day wasn’t particularly comfortable. I spent all of my time on my back.  
Friday, I.E. Day two after the surgery was much better. I couldn’t really stand up straight and getting in and out of chairs was hard but it was really not that bad. I certainly had no problems eating. By later on the previous day I was able to eat normally and this continued. The pain in my stomach where the stitches were healing was annoying but it wasn’t particularly limiting. What was limiting me was the advice given by everyone around me to take it easy.  
Saturday was a continual progression on the previous day. One thing I’ll say though is after this surgery, going for a poo can be really uncomfortable! You’d be surprised at how much you use your stomach muscles when pooing! I went between two stages of very constipated and very ….. Not constipated up to that point. Sorry to be too descriptive but one of the purposes of this blog post is to help someone that is at the start of this process.  
By Saturday night I could comfortably sleep on both sides. On the previous night I could sleep for a short time on each side but it wasn’t comfortable. One tip I would have is to drink Sprite. Yes! Sprite! They pump you full of air when they are removing the gall bladder. I don’t know how or why but sprite helps the air move. A glass or two of sprite and I felt like an entirely new person.  
On Sunday I made a really stupid mistake. Firstly, I showered for the first time since the surgery. I was nervous about this as stepping into the bath on Saturday would have been uncomfortable. However, on sunday it was absolutely fine. It surprised me how much I improved from day to day. After the shower I attended a church service for the commemeration of the 1916 rising. Following this I participated in a march for just over a mile to a local monument. This was very hard work. I still wasn’t standing up straight at this point. It was the walk back that really started to get difficult though. I made it about half way back but I had to call Emma to ask her to collect me. I just ran out of energy. There was no way I could have made it back. Oh. I should explain that I also hadn’t had breakfast that morning. I also didn’t take the anti-inflammatory that had been proscribed either. I really should have know that this wasn’t going to end well.  
I got back to the house, took the tablet, eat some food and felt like myself again.  
Later that day as tradition requires we took the kids to my parents house for the afternoon so they could play with their cousins . This was tiring probably because the morning had been more of a challenge than I would have liked but it was still very enjoyable. Sorry. I should say to people reading this that the Sunday I’m referring to was Easter Sunday.  
Knowing that life needed to return to normal on Tuesday, I spent Monday doing very little. I slept until about 1PM then did nothing else other than enjoy the company of my wife, son and daughter for the remainder of the day.  

By Tuesday I was able to stand up completely straight. I’ve been able to get in and out of the car with absolutely no struggle at all and life really has returned to normal.  
I removed the bandages on Wednesday and I’ve begun lifting things again today 9 days after the surgery.  
People keep warning me to take it easy but I like to think I know my own body. I don’t feel sore other than the occasional twinge. I’m being careful to take things a little slower than normal but I’m not shying away from anything.  
This surgery has been a great success I think. I no longer feel any small pain in the evening under my left lung and just over a week after life is back to normal. a picture of me on the hospital bed giving a thumbs up 

Vegan week challenge podcast

I’ve done it!

Seven days. One week of no meet, dairy or any other product made from animal products.

Thanks to Jenny from Paws for thought for suggesting this.

This challenge fulfilled the objective of looking for thirty challenges for 2016. It’s to force me to try something that I’ve never done before and maybe expand my mind a little bit.

The podcast that summarises this week is here. I@m sorry I didn’t keep blogging every day but I’m out of the habbit of doing this and some nights I’ve just been too tired.

Listen to my Vegan week challenge podcast. Special guest: Emma.

Actually, I wonder if this tiredness has been related to the Vegan challenge. Come 9PM I’ve been falling a sleep. I could be doing some work or relaxing in the living room but when it reaches the end of the day I cant function any more.

Maybe someone could comment to suggest if this is a possible cause?

Vegan week – Day 2

I was working from home today so I wasn’t up and out so early.

The coffee with the Coconut milk is ok but it’s not great.  It makes the coffee taste very strong.  I usually like a good strong coffee but this was different.  It’s tolerable but not great.

This afternoon I tried Almond milk instead.  This makes the coffee as smooth as with normal milk.  I’d definitely recommend it.

Of course I started with my normal bowl of Weetabix.  I made My daughter Méabh’s first using normal milk but she has her eye on the coconut milk.  I’ll probably work from home again for a day or two this week so I must let her try it.  Again, it’s fine.  No major difference. I find that the Weetabix goes a bit dry faster than with normal milk but that’s a minor annoyance.

This afternoons dinner was late.  Sometimes schedules just can’t be met. I had a lot of work on that wasn’t being very accommodating to my need to have sustenance around 1PM so I waited until about 4.

Today’s dinner was a Vegan shepherds pi. The recipe is below.  Please believe me that it was one of the nicest things I’ve ever tasted.  It was just fantastic.  That’s definitely one we’ll do again.

Dinner can be found here.

I’ll hold my hands up and say that because we are using fresh produce for everything I’m absolutely useless when it comes to cooking this stuff so as one of Emma’s aunts pointed out, Emma has taken an on a lot of the challenge of this week.  This isn’t lost on me and I really appreciate it. I wouldn’t have a clue where to start with a lot of these new dishes.

We weren’t in the mood for anything substantial later today so Emma made these small biscuit things.  Again, they were really good and apart from the bit of jam on the top, they were very healthy.  Unfortunately, Emma didn’t particularly like them but I thought they were fine.  Again, the recipe is below.

The snack can be found here.

Thanks for following along and thanks for the comments.

Vegan Shepards pi just made. File 16-02-2016, 23 04 29 File 16-02-2016, 23 04 49

Vegan week – Day 1

To the Vegans:
Please don’t think that I am belittling or disrespecting your choice if you are a Vegan. If anything, my exploration of one aspect of your lifestyle is a sign of admiration for the choice you have made.

Here goes. Day one. It started like all days. Up at 6:40AM, Grab a cup of coffee and a bowl of Weetabix before jumping into the shower, shaving and running out the door. However, today I couldn’t have dairy so instead had Coconut milk. First impressions are that it’s actually not that bad.

Dinner was a vegetable biriyani. Rice, a truck load of vegetables that I never eat and some kind of sauce.

At this point I need to credit Emma. She’s doing all the hard work in preparing these recipes.

Dinner was lovely. The vegetables and no meat made for an unusual texture but the taste was fantastic. There were a few vegetables in there that I wouldn’t really like but you really need to understand that from a very early age I have had a loathsome relationship with vegetables. I hate the things with a passion. A small bit of a carrot on my plate is enough and only very rarely. That’s one of the reasons I’ve taken on this challenge. I except that I need to change so this will force me in the right direction.

Dinner can be found here.

Tea was a vegetable burger. It’s a recipe written by Jamey Oliver. Not the nicest thing I’ve ever eaten by a long shot. The description suggests using sauce and after trying the burger without the sauce I fully understand why that’s a suggestion. Ordinarily I never use sauce. I think it’s almost disrespectful to the cook. It’s basically saying that you need to hide the flavour of what has been cooked by using an over powering sauce. That’s probably what is needed with this burger but it wasn’t bad with a small bit of sauce so that will be tried again later in the week. There are still two there so we’ve put them into the fridge for Wednesday night.

That’s it. Short and to the point. Today was the first day of my week long challenge. It wasn’t half as bad as I thought it would.

the burgers can be found here.

 

Pictures:

eFour Veggie burgers in a pan File 15-02-2016, 23 40 10 File 15-02-2016, 23 41 13 File 15-02-2016, 23 41 34

30 Challenges in 2016

Jenny is to blame for the following posts.
She’s turning 30 on Thursday. Wish her a happy birthday in the comments or over at her blog. To mark this she wants thirty challenges for the next year. I became very interested in this and stole the idea a few weeks ago.

Since then people have given me a number of suggestions such as

  • Learn to use a compass and read a map. Using some kind of accessible method.
  • Clime Croke Patrick and play a tune at the top.
  • Knit a granny blanket.
  • Make finding a basketball hoop accessible to someone who can’t see where it is.
  • Eat vegetarian food only for one week.
  • Learn a tune on the fiddle
  • Play music for 24 hours solid.

There’s more but I’ll give more detail in the next week or two.

I love all of these suggestions and where possible, I’m taking them to a slightly new level. For example, I’ve heard a lot about veganism in the past few weeks so instead of just eating vegetarian for a week I’ve decided with the help of Emma to go all out and try a vegan diet for a week.

This week I’ll explain some of what this will inhale.

As those who know me will understand, I love meet. Chicken, stake, some fish, pork, it’s all good. Having no milk or dairy products or in fact, no products based on animals at all will be a shock to my system. However, I think it’s an important exercise and challenge so I’m up for giving it a go.

The following posts will explore my vegan week in more detail. Look at the 30 challenges in 2016 tag for more.

Error updating iPhone. IOS problems.

I’ve had problems updating my iPhone from IOS9.1.1 to IOS9.2 since it was released in the middle of December.

I’ve tried the usual fixes:

  1. Updating from the iPhone as normal. This fails just after verifying the update.
  2. Updating from iTunes. This fails trying to create a backup. IT always says there isn’t enough space on my 2TB hard drive that’s about 50% free.
  3. I even resorted to resetting to factory defaults and installing the update before restoring from an iCloud backup. This gave the same errors as before.
  4. Obviously this is after various resets and trying from different wireless and wired networks on different Internet connections.
  5. I’ve even tried changing my regional settings to see if it was something related to my connectivity to an Irish update repository.

Today I’m trying something different. I’ve downloaded the firmware for IOS9.2 and I’ve restored using that IPSW file using iTunes.

Of course this is going to wipe the iPhone again but restoring from an iCloud backup using Doulci activator will get everything back as it was. Excluding WiFi, Email and social network passwords for some reason.

This is the first time in about six years that I’ve had problems with an IOS upgrade. It’s quite frustrating and disappointing.