WSUS and PowerShell: Audit-Compliance Report and Automatic Cleanup

Its been long since I wrote anything on WSUS. As Windows world evolved, many of the troubleshooting steps might be bit out-dated now but WSUS functioning and basics still remain more or less same.

Today I wish to take another aspect of WSUS and talk about WSUS Reporting part and regular clean-up.

WSUS Reporting:

WSUS has a comprehensive reporting system built in and if Report Viewer installed over the server, one can variety of reports, but the same remains limited to a pre-set and also one server only. Let’s think of a scenario, where one might have more than dozens of WSUS servers catering thousands of machines and rather logging over each one or attaching them into one console, we want to have a consolidated report to see if patches getting installed well and also whether team is meeting compliance by install each single patch of (M-1) month.

Now what my PowerShell code does? It bring a report like below in csv format:


This would include how many patches are needed on which machines, when those machines last contacted their respective WSUS servers, what IP and OS do they have and which particular updates are pending on them and those pending updates were released when. Also it tells count of those updates which have been downloaded or pending download or pending reboot of machines to complete the installation.

I believe this pretty much covers what a system admin might need to get an overview of issues and to address them. Apart from this, what the script does is, it creates some more CSV files, one against each WSUS server mentioning that which particular updates were released between the period of 1st day of (M-2) month (if today is March, then we talking about January 1st) and Second Monday of (M-1) month means just one day before Patch Tuesday. Based on this data, one might check if any of the last month patches are missing on any of the servers. I have written a Excel Macro code around that as well but that still needs updating and make compatible for general usage so would post that at some later time.

Continue reading “WSUS and PowerShell: Audit-Compliance Report and Automatic Cleanup”

PowerShell Report of Office 365 Licenses Assignments

In the last post, we talked about reporting how many users you created yesterday or in last 7 days or may be in last six months. A similar requirement is to know how many Office 365 licenses you assigned in last 24 hrs or in last 7 days.
Continue reading “PowerShell Report of Office 365 Licenses Assignments”

Finally a group trip to Agra blessed with good weather luckily

What kind of year puts 2nd October, Christmas, Diwali all on Sundays? Yeah.. its current year 2016 only, which left the cult status holding August mid as almost the last long holiday to roam places for professionals across India. Result??? Almost each popular destination across Metro was supposed to be flooded with desperate crowd looking to have a good time.

This year cult August Mid had kind of double treat considering not only Monday was off but a Thursday too, means those who missed the first long weekend Sat-Sun-Mon, were allowed to make it into the second weekend after taking just one day Friday off ending up having Thu-Fri-Sat-Sun. The same scenario enabled those offices with multiple shifts overcoming the issue of only one of them getting the chance and others slogging through weekends. But for me, it was still tough considering the question that where to go?

Been to Lansdowne few weeks back, been to Nainital in April end, been to Dharamshala in mid of March, been to Manali in last December, been to Rishikesh before that, Mussoorie trip would have been of no point, then where to go? Sitting back home was kind of becoming only option considering unavailability of hotels in all major hills around Delhi, but then knowing that there is no other long weekend left this year, we had to go for some trip.


We explored the idea of a Chail monsoon trip as never been to Shimla side but then colleague from Mohali and others who been to that area warned about the kind of roads in last leg of journey during unpredictable Monsoon. Same time hotel rates and unavailability in general became last nail to coffin of another Shimla side plans. (That side trip always getting dropped in planning stage since a while, let’s see when I manage to change that.)

Agra was selected based on shortest possible distance though I been to Agra once (before marriage), wife been to Agra once (before marriage), brother been to Agra once last year itself and the only partners who haven’t been to Agra were brother’s wife and my daughter. That was enough excuse for us to go for another trip.

Booking hotel through GOIbibo was another ordeal. Brother booked the same and at first Hotel Karan Vilas was confirmed by GOIbibo but brother got call from hotel that they don’t have any rooms available. On reaching out to GoIbibo support, he was ridiculously asked to cancel the booking and bear the charges of 500 Rs on him, which sure was enough to make us furious as what fault was on our part?

Later after discussing with seniors in GoIbibo support, we been offered Hotel Orchid. Hotel Karan Vilas which we had selected was on Main road, had swimming pools etc while this one was little off-road and without swimming pool etc so this was sure a rip-off on us but we okayed it at the end. Though later on during the trip, we got call from same Hotel Karan Vilas that they are holding two rooms for us. Don’t know where the miscommunication was but then we ended up in Hotel Orchid only.

Continue reading “Finally a group trip to Agra blessed with good weather luckily”

Single day family trip to Lansdowne

Don’t know if the trip to Dharamshala side has raised the bars or I am out of luck about hill trips in recent that not getting enough satisfaction from the hill drives. After last hill trip in April, last week of June 2016 seen another quick hill trip and this time destination was Lansdowne.

The plan for the trip came in mind as brother’s wife was dropping by for two days and we planned to take around hills. Later on, it was realized that it would be too hectic for her and the plan was dropped. But too late to save me from the poison of travel bug…..

We decided to take on the hill trip one week before it was planned and even though wanted to accommodate brother as well, it was again a family trip only.


As been a norm for our hill trips, we started early from our apartment at Faridabad and first stop was taken at around 0530 hrs near Modinagar.


The route may be of less than 270kms, don’t expect to cover the same in less than 6 hours, thanks to road and traffic conditions. Not some kind of worse but not super highways either. We got stuck for few mins at Najibabad area, where Bus station/ Railways station by the road were enough to create jam.


Before 0900 hrs, we had crossed Kotdwara which is the point from where hills start. The above pictures were taken around Mankot, which was few kms before.


And almost after 10kms another stop. Roads were ok in condition though on narrower side. Would have been trouble if both side traffic though that day being kind of non-season may be and early morning, it was manageable though bottleneck to speed. After taking many a stops, we might have reached there by some 1100 hrs.

Parking wasn’t tough though for my surprise, it was sufficiently crowded. Bigger surprise was the hotel room tariffs as none of them was either available or less than even 2000 Rs a night. This was sure high for such a small hill station as I expected such rates in Shimla etc but not in Lansdowne at least. Before even starting to explore the area, the decision was made that it would be single day trip than two days as it was earlier planned.

We stopped at good restaurant for the Aaloo-Paneer Paranthas and tea and then moved towards the lake.


The lake, which even though might be looking ok in picture, wasn’t in good conditions in this season at least. Dirty and stopped water, not sure how it remains in other seasons or post rains. Good thing about it was proper parking place, nearby lawn etc.


Don’t remember exactly but Entry ticket prices were nominal and even boating prices were ok though we chosen not to do boating (time constraint and disliking for the water here).


There was a rabbit house in the lawn side which was the main attraction for kiddo.


After spending almost an hour there, we moved towards tiffin top. After driving a little, there comes a place, where the road to tiffin top was mentioned but that seems to be for peddlers. Though some of the vehicles been managing to drive through there, I wasn’t too sure about it. Some other families like us been trying to enquire about it and soon a local guy passing by informed us about the main route for vehicles.



Views weren’t that clear but honestly speaking, the place looked good about sunrise and sunset only and unfortunately we didn’t had time for both. Parking options were bad at the place though we managed it. Must have left the spot within 30 mins and then decided to head back to home entirely.


The above was at around 1430 hrs and it was still cloudy day all around.


We took a break at some under construction hotel in midway. Many laborers been cleaning the river and I was thinking what if State Govt itself does the widening/ cleaning works on rivers under MNREGA etc. Important task considering the tourism etc, but then who know NGT ego may be hurt again to pass another random Tuglaq style order.


The place would be good photo stop in coming days.

The good times were to end once we were in plains. Area around Modinagar was hell for driving due to long traffic queues and despite of our tries, we reached home by 1000 hrs around only. It would have been 8hrs journey back to home but return journeys always feel longer. The good part was, I had a day off on next day.

Another hill trip was over and I was still unsatisfied from hills while winter seasons and snow still far away. Manali side anyway has been destroyed by NGT tantrums.

Active Directory Reporting by Emails via Powershell

Monitoring a large Active Directory environment always comes with so many requirements at times. Some of these might be based on various business requirements while some of them are meant for being proactive over the changes in the environment based on daily activities. All the codes applicable to Windows 2003 environment but should work for higher than that as well.

Let’s visit some of the Powershell scripts which might come useful at times:

Dump of all AD User’s info + group Membership of each user along with all relevant attributes

The below code isn’t sending HTML email, but plain text with two attachments only. We can schedule the same weekly basis or fortnight basis to keep snapshots of AD on regular basis to refer at any point of time in cases of requirement.

Continue reading “Active Directory Reporting by Emails via Powershell”

Nainital again–A lesson when not to go for a hill trip

A hill trip?

But its not long when I been on the last one to Dharamshala, then why another hill trip again within two months? And what’s with the depressing title? What can be a wrong time for a hill trip? Was it really that bad?

Apparently nothing that much depressing as we had our fun times and enjoyed whatever we got, but yeah considering the memories of last two trips (both been during Monsoon) and opportunities available with us this time, it would have been more memorable if appropriate weather. The Uttrakhand Fires which picked up in news only when our schedule came closer apparently was even more disastrous than it was looking on TV. Entire view was blocked by kind of smoke, so literally NIL hill views. But then Nainital is never about hills only.


Why the trip? The plan and schedule

One doesn’t really need an excuse for a hill trip, at least not me, but this time I was just getting fed up of hectic office routine since last few days. I am always known to be workaholic, but when you start feeling that its under appreciated or like people in upper food chain don’t have any idea that what really going on, only thing which can delay the inevitable for a while can be diversion of mind. Rants apart, the last trip as I said even though was kind of best, but as I wasn’t on driving seat so that longing refused to die and I wanted to take a trip somewhere before May-June comes. I thought end of April would be little colder and pleasant in hills like Octobers etc but I was wrong about weather at least (thanks to forest fire).

The schedule chosen was 29th May – 1st April 2016 (Friday- Sunday). We were supposed to start early morning on 29th and then first day stay was in Hotel Mohini Inn, Nainital and second day stay was in Parwati Inn,  Ranikhet. Bookings were done was Goibibo and I managed to get the second hotel under 600₹ even. We thought to include brother and his wife in the trip, but their schedule was engaged, so it was family only trip again.

Finally the day of drive and hiccups

Route searches always warn you about Rampur-Rudrapur stretch but as been our experience in last trip, that was manageable. It wasn’t the road quality which concerns but the kind of width and traffic. It’s a two way road for 60-65 kms, where its hard to overtake with traffic hence irritating at times for drives which was coming from a long way from full speed highways.


Started by 0330 hrs, we chosen to stick with main route, thanks to inputs from Colleague Naval who just reached to nearby area one day back. Start of the drive went into discussions related to kiddo school selection in coming days and then shock of the trip hit me once we reached the first toll. My ever loyal car decided to give the first major trouble to me.

It wasn’t that kind of major if we look at it, the issue was the horn of the car stopped working. Those who drive on highways can understand that even though minor, how big headache that can be. Then considering the very early hour of the day means we weren’t gonna find any mechanic either. Anyway, we found one shop open by 0600 hrs around though no senior mechanic was there. Luckily the guy who had opened the shop managed to fix the horn. I happily gave him 50 Rs and drove ahead but the joy was short lived as after few kms I found horn to be down again. Though this time, I had seen that what that guy did and was able to replicate the same myself but then it was a temporary fix as it was going down again and again.

Thanks to the glitch, we were set back by more than an hour or so as managing Rampur – Rudrapur stretch without horn was so irritating. Also as it was Friday, the Muslim majority area had almost all mechanics on leave for the day so there was no permanent fix for the horn in rest of the journey.

Additional trouble was AC going down again and again. Yeah Yeah.. my car always been loyal to me and this was the first journey, when it started showing tantrums (no deal breaking though). Later on servicing few weeks later of the trip, I got to know that one of the radiator fan was faulty which needed replacement and overheating of the engine was causing the AC troubles. I find myself lucky that the car didn’t overheat enough to cease even at high speeds.

We might have reached the destination by 1100 hrs around after taking plenty of breaks in between and when we been searching for hotel location, luckily we met one of the hotel guy itself, who drove to the hotel himself, which would have been tricky otherwise as it was on a high slope. This is something which always remains trouble on hills. An easy parking place means you frequently use your car otherwise you prefer local transport. It was later for us then.

Wife was so tired and wasn’t ready to leave the hotel room early, so we decided to take bath first, then rest a little and then to Mall Road. While wife was concerned that it might be a long walk from the hotel that came out to be roughly 500m walk off-road without much of slope so easily manageable.


We were at side of lake by 1400 hrs and then we chosen to book a SuV for sight seeing. 800 Rs for various spots, it wasn’t a bad deal sort of.


Rock garden was first stop. Last time we parked the car in front of it but didn’t went as I didn’t thought it worth. Anyway, this time I knew that I was correct last time.


Then we moved towards top, which was the first viewpoint. Can imagine that this is the place from where snow peaks might be visible and it must be happening place, but considering the Uttrakhand forest fire, all the view was gone as you can see and this was just start of disappointment in the trip. BTW the last picture showing the SUV, which we had booked for the sight seeing.




Lover’s point was the next stop. Again the same complaint, lack of views due to smoke, but we had started living with that complaint.


Khurpa Tal viewpoint was the next stop. I had read about the same in many blogs and even had considered to drive from Kaladhungi side to have a view of the same. The view was sure precious and the driver told us that we would get an even more closer look than this.




It was a nice photo ops place for sure, but we had to move ahead.


Then we reached to some artificially created waterfall, where we took the lunch in a nearby shop.


And then after a closer look to the Khurpa Tal, we were back at mall road by around 1720 hrs. This time we have thought to cover the points, which we had skipped in past so the next turn was the Naina Devi Temple.




And how we could have visited Nainital and missed boating? Even if we had thought so, kiddo wasn’t going to compromise.




During off season like this, they usually cover more ground in lake otherwise almost half of the same. Lake also wasn’t that much crowded as we found during August last years.




Some photo ops on lake side and then we moved towards Mall Road. Walking with kids in hills always come to be tough as while you are already tired, kids refuse to walk. After all, they have the option available which we don’t have.


Finally we gave up and went back to hotel. I asked the hotel guys to clear the bills as I had to check out early morning and we might have gone to sleep early around 0900-0930 hrs. Next target was Ranikhet as that part of drive we had loved most in our first Nainital trip. We decided to skip Mukteshwar this time as read that views of snow peaks is similar to Ranikhet so if snow peaks gonna be visible then they gonna be visible from Ranikhet as well.

Day 2: The drive to Ranikhet

From scenic point of view, we had big hopes from this day but considering the fact that we been to upper places of Nainital and found no views, we knew that nothing much gonna be changed in Ranikhet either. We might have started by 0530 hrs around and it didn’t took much long for sunshine to greet us.





The road was good for most parts, say 99% but there were patches which seems to be remind of landslide kind of. I used to think that this side of hill was comparatively safe to travel during Monsoon as travelled twice but it seems that it might be different as well.




Considering the fact that the river which accompanies the route to Ranikhet was almost dried up, we didn’t had much hope for photo ops but it seems nature had its share of surprises in store for us in form of fall colors.






After reaching Ranikhet, don’t know what route Google Maps and Here Maps preferred to guide me on and we spent almost an hour figuring out through narrow streets.


We reached to the hotel at about 1030 hrs and there was this interesting coincidence about this hotel. In first trip of ours to Nainital, it was rainy season and we had no prior bookings and after searching through streets, we had stopped at this hotel at first choice considering the fact that this one was with the best comfortable parking area. But then we were quoted more than 4K per day even when we wished to stay for the night only and was ready to accommodate in single room itself. This time, can you guess what was the rent? It was roughly 550 Rs, which anyway was paid in advance online. As I overheard, the manager of the hotel wasn’t quite happy about the kind of pricing he was getting from GoiBibo but for me, it was kind of revenge served Smile with tongue out





The only worthy place in Ranikhet was the Golf Course, though it wasn’t green type as it looks in Monsoon but fall colors weren’t bad either. We reached there around 1115 hrs stayed there till around 1230 hrs and then left. Rest of the day was spent in unsuccessful attempt to reach a nearby lake and outside lunch. We slept early to get up early in morning for the drive back home.

Day 3: The drive back home and stop at Bhimtal

We might have left the place by 0500 hrs and it was a relaxed drive considering the fact that time was our side as we were free to reach home by evening.



We spotted the above at around 0525 hrs and don’t even ask me that how it happened. After all, this is hill road and one can’t expect someone driving drunk and over-speeding. One can really expect tourists to be so but not the regular drivers commuting daily. Still don’t know how it would have happened.


Before heading back home, we decided to take a stop at Bhimtal lake. Boating was off this time as Military was taking water from the lake to douse the forest fire.




While I understand the gravity of situation, but still not completely relate with the practicality of solution as for one trip, the helicopter had to set itself at least 2-3 rounds. More efforts for less water it seems but then I am no expert over such matters.





Kiddo had fun with ducks around. We invited some in pretense of food but once they knew about it they didn’t came near. Not really sure that what one supposed to give them for eating as regular eatables are prohibited to be given.



We left the place by 0830 hrs around and headed back to home. Apart from an incident when during lunch, I had to stop to give some remote support to office, most of the drive was eventless. I got the horn repaired and also stopped to the construction site of our flat in between.


We reached back by 1630 hrs around.