Healthy, Good and Quick

Most of us live very busy lives.  The tradition of families sitting down together at a dinner table every night has become a sitcom fantasy.  The quick and easy / grab and go meals sometimes seem like the only way to go.  Unfortunately this leads to less than nutritious  lifestyle habits.

But what if you could pump out a healthy meal in 30 minutes which you could eat for days?  I strive very hard to come up with such meals for my very active on-the-go family.  Most of their favorites I came up with on the spur of the moment from whatever I could find in the house.  You would be surprised at what you can toss together and make culinary magic.

Below I thought I would share one of those favorites.  Takes less than 30 minutes and lasts ‘very well’ for days.  I’ll take it to lunch at work and/or makes a quick 2 minute meal after I get home from the gym or a run late nights after work.  None of those fancy special ingredients necessary.

I will list exactly how I fix it but you can substitute many different vegetables or sauces.  This is definitely a recipe you can play around with.

Ingredients

  • 2 lbs 90/10 ground beef
  • 1 yellow squash chopped
  • 1 zucchini chopped
  • 1/2 large white onion chopped
  • 1 medium cucumber peeled and chopped
  • 1 large jar of medium chunky salsa

Steps

In large stew pot add ground beef on medium heat.  While beef begins to brown chop the rest of the ingredients.  Add to pot as chopped.  Cook until beef is done.  Drain the juices. Add ingredients back to same pot and stir in salsa.  Continue to cook on medium low until heated.  Store left-overs in fridge.  Enjoy.

Mother Daughter Trade Off Day

I rarely take days off work even though I have plenty of time.  Why you might ask?  Well, my job is just fun.  I love a good puzzle and my job is nothing but a constant revolving set of puzzles.  Odd but yes, I love to work.

But this summer I decided to purchase season passes to Water County / Busch Gardens for my youngest daughter and myself.  This would force me to take some time off this summer and do some fun things outside the puzzle world.  So we planned to take Wednesday and make the long trip and spend the day speeding through the water.

Unfortunately my daughter developed a stomach issue the night prior to departure and did not feel like it would be a good idea to keep our travel plans.  Minus 1.  So I decided to take her shopping for some new school shoes.  It would still be a day together.

We get ready, hop in the car and leave after breakfast.  First stop, the bank.  I walk up the ATM, do what I gotta do, then get back in the car.  As soon as I sit back I feel like a knife is stabbing me.  We jump loudly out of the car and jump around like monkeys.  We see this very large bee fly away.  Ohhhh great!  I’ve been stung.  Minus 2.  I bend over to grab my card and money which flew out of my lap and then my bracelet brakes.  Minus 3.  Ok, not gonna be my day.

Bee Sting

She looks area over for me while I cringe in pain to find a stinger.  To describe what I was feeling would be to tell you to imagine a large set of tweezers digging into your skin, pinching you and twisting.  It then began to shoot up and inward.  We sit still for a little while so I can decide if I will let this ruin our whole day or if I can keep it together until we get home.  Because I do not take days off, I decided I was not dizzy, could still breathe and should be okay, so we left and went shopping.

There was no traffic on our route, which was very odd.  There is never any ‘no traffic’. Plus 1.  So we arrived at the mall in good time.  I go into a changing room to try on a top and my dress strap decides it will add to my lucky day and breaks.  Minus 4.  Luckily the top of the dress is tight so the missing strap just made the dress look like it was supposed to be strapless.  Plus .5.

We go to the second mall to get some strange 3DS game, pull up to the normal parking spot and notice they have closed down that doorway.  Minus 5.  Sigh, we have to drive around and go into one of the department stores a ways down.  It just keeps getting better.

We decide to grab some lunch at the food court, walk right up with no line, get our food, sit down and a line forms with tons of folks.  We got lucky.  Plus 2.  We make a bathroom stop, no line, we walk out of the stall and there are literally 10 people now waiting.  Plus 3.

So all in all we had a good day since we spent it together.  3.5-5 was the ending score, but I guess the trade off to not having to wait in any lines all day with the bee sting, broken bracelet and broken dress still was an okay trade off for a mother daughter day out.  Now the remaining days after with the itch that follows is another story.  What if karma is nudging me to never take another day off again …  Pfft, Water Country take two next Wednesday.

The Seven Year Ditch

A story of week one post Yaz:

Disclaimer: Because I believe an actual account is important for anyone on Yaz, maybe thing of taking Yaz or coming off of Yaz it may be TMI but informational.  Also this is my experience and may not be the same for anyone else.

For more than seven years I have been prescribed Yaz.  Not for birth control but for PCOS (polycystic ovarian syndrome) management.  We have all seen those commercials with warnings and death threats but even so I was told by a doctor I trusted that this was my best bet and since I was in good shape and never smoked I wouldn’t have anything to worry about.  So I started popping one every morning.

Roughly two years later I begged to be switched to a different pill.  I just couldn’t handle the odd side effects and wanted to see if a different one would be sufficient.  After six months I was begging him to put me back on the Yaz.  The hot flashes, cysts, cramps and more seriously the strong feeling to brake down walls with my fists for no apparent reason was too strong and I hated that feeling.  So he gladly put me back on it and all went back to my new normal.

Here it is another five plus years later; my trusted doctor retired and I switched to a new one whom I thought would be perfect for me; a woman, a runner and a PCOS sufferer.  Second year exam I mentioned stopping Yaz again now that I’m 40 to see if it would help with my newest symptoms; high blood pressure, rising blood sugars, excessive weight in the mid section no matter how well I eat or how many days/work outs I do per week.  The latter has been a struggle for which I still have yet to understand, but that is another story.

I got the excuse that I’m getting older and those things will happen.  I’m sorry, but I’m only 40 and I just did not except that reasoning.  But like a good little school girl I kept on taking it.  Well one week ago my prescription ran out.  My appointment is in two weeks and I tried to get it refilled for one more month to take me to that day.  The phone kept hanging up on me after the transfer.  I took this as a sign and stopped taking Yaz.  After this long but choppy introduction, here is how it went:

Day 1:  Very tired but nothing really felt different

Day 2: Woke up with enough energy at 5:00AM to run the earth.  Needless to say I got a lot done around the house this day.  Also had my first strong headache in quite some time.

Day 3: Exhausted even before waking. Never recovered.  Fell asleep even while walking through the grocery store, so missed a few of the isles we walked down…  seriously… sleep shopping is scary.

Day 4: Energy burst throughout the whole day similar to day 2.  A project on my to do list for two years – done! (re-staining deck)

Day 5: Day 3 all over again

Day 6: Pain, oh the pain!  Cramps kicked in like I have not had in seven years except for the few cysts episodes and I wanted to kick in those walls again.  Needless to say I gave the office a warning when I walked in that the devils nightmare has returned to posses me.

Day 7: Oh unwholly mother of all hot flashes!  Decided that my hibernating hormones for the last seven years are trying their best to get a jump start.

Day 8: Here is the most unexpected post side effect day.  The others I knew would be coming.  Yaz shuts off your own hormone production and since I came off of it, I knew my body would eventually begin to make its own again and thus the ‘normal’ hormone-y symptoms would be exasperated 100 fold, but this?  I literally began to feel like I had been wearing a heavy blanket over me for seven years and now it was gone.  I have no other way to explain it.  I just felt really different beginning on day 8.

Day 9: So for the last seven years the sex drive was G-O-N-E.  I could have cared less.  Guess it is a good thing my husband loves “me”.  I always attributed it to my high stress job, was going to school, having three children with two going through teen years and one just born, yard work, house work, piling bills; you all know how this list continues…  I’m sure this still played a factor but on day 9 this also kicked back in but with pain.  I’m telling you my body had completely forgotten all about this part of life and when I say came back with pain I mean with pain.  Not a good thing.

This loss of the heavy blanket feeling has continued since day 8 and I am really loving this the most out of all of the so far experienced post side effects.  I just cannot explain adequately how much better I feel over all.  A feeling I have not felt in so many years that I believe my heart grew three sizes in the first week post Yaz.  Yes that was a Grinch reference and it really does sum me up.  Think on that…

My mid section has shrunk two inches and I have changed nothing about my routine.  Still eating well, still working out hard.  Who knows how much more I will continue to improve, change or morph into the person I used to be whom I had long forgotten existed.

Do I believe that this was the drug of choice for my condition?  I do…  It helped me get through a very rough diagnosis with symptoms that were horrible.  It did not stop them completely but made them manageable so they did not effect my daily life every day.  I think after so many years I just became dependent on it, especially after trying to switch off and having such a horrible experience.  Fear kept me a daily partaker more than anything.

Do I feel this is the right thing for me at this point in my life?  Most definitely.  Do I think it will be easy?  Heck no!  But I am more educated now than seven years ago about PCOS, what it is, what causes it and alternative ways to fight it.  As this is a condition and not a disease, it is a life long battle but one I feel much more prepared to fight.

Now my new doctor…, am I ready for that battle next week?  Probably not so much as I know it will end with a conflict of personal interest but I refuse to accept the reasoning that since I am in my 40’s that it does not matter how well I eat or my fitness level that the newest symptoms are only manageable by drugs.  Until I see this for myself I will fight it like…, uh this is a PG blog, Ares.

Spring Cleaning

Weeks upon weeks of horrible eating has added a winter layer to my spring wordrobe and an all over feeling of sludge to my daily routine.  It began with the Paris trip.  Breakfast and dinner was pre-selected for us and was loaded with breads, cheese and more breads accompanied by tons of carbs.  Being diagnosed with PCOS almost ten years ago my body tends to mock and tease the “carb click” so when they get a chance to take revenge, I pay heavily.

Then comes TechEd.  Granted there was a bowl of fruit at breakfast every morning which was very nice, but the rest was conference food.  Granted the last night the baked chicken was very tasty.  Then the snack bar…  M&Ms, salty goodness, pretzels… You get the idea.  And I NEVER drink soda but for some reason every year it never fails I end of grabbing Mountain Dew cans from the fridges between sessions.  I still have not figured that one out.  I will not drink another until next year.

So when I finally strolled onto the plane Friday morning with a swollen belly, headache and my internal organs auditioning for Carnegie Hall I knew I had to do something drastic to get back on track and just push the flush nozel.

Once I get picked up from the airport we head to the grocery store and fill up the cart on fruits and vegetables.  Not to cook or snack on but to juice.

IMAG0429

I did a three day detox approximately 1 1/2 years ago and it was one of the toughest things I had ever done, and I’ve given birth to two babies without pain meds.

But I emerged from that experience feeling great.  I was not in it for weight loss, I wanted to reboot my taste buds.  I’m a self-proclaimed chocoholic and spaghetti lover.  Neither of which are beneficial to a PCOS victim but even those with the best of will power call succumb to both of these.

Which leads me to this decision.  But this time around I want to go for five days.  I’ve heard you need to stick it out for longer than three days to get the full benefit so I thought I would try it out for myself.

This will be my virtual account of the steps, feelings, and final outcome of this nickel length journey.

Good or bad I’ve made my decision and I’m sticking to it.

Pausing the Stubborn

For quite a while now we have seen the ads, heard the speeches and probably like most still ignored them all.  The Go Red for Women campaign.  There is a reason this exists.  Women are a stubborn gender.

We endure many things as silently as possible.  After all, we are the caregivers, the providers and the rock of many family units.  We do not like to show weakness, and this includes pain or giving into illness.  That big ‘Ignore’ button is always flashing and ready to be pushed at a moments notice.  And let’s face it, we push it often.  Too often.

I was a lucky one but like many before me I pushed that button so many times two nights ago it almost short circuited.  In foresight, it was a dumb thing to do and I’m glad I eventually made the right decision.  But if this story had been different, it may had been one time too many.

Sunday morning, first longish run after a half marathon, group of ladies hit the trail like we do every Sunday at first light.  It was a chilly 48* which is perfect for running.  Unfortunately my ankle was just not going to allow me to run so I speedily walked until everyone had completed their intended distances.  We hopped in the car to head to our breakfast hangout and as I was turning back to speak to the ladies after yet another forceful sneezing frenzy a very sharp pain shot right through the left side of my chest and down my left arm.  I had never experienced such a pain.  I knew for certain it was not muscle strain or the like.  It was just ‘different’.  I stopped mid word and could not even breathe.  I played it off like a champ and all of about 30 seconds later it eased off and I finished that word and continued through my day.

At 1:00AM that morning I woke suddenly with severe upper stomach pain and nausea.  First I thought perhaps it was something I ate and just laid there for about 30 more minutes trying to breath my way through it.  Then came the slight dizziness.  I chalked it up to being tired.  Then the chest pain hit furiously.  Just on the left side.  It began to radiate through my back and to the center of my chest.

I would get up and walk around to see if I could make it ease off to go back to sleep.  I even had a slight thought of heart attack and started up my Surface to do some research.  There was no throbbing, no dull ache, no pain like explained on the many webs sites for heart attack, not exactly as written anyway…

I went back to bed again and then my left arm went numb.  That funny feeling that you get if you sit on it for a while and the blood comes rushing back.  Almost painful.  The nausea got worse and I got scared.  I really had the feeling if I closed my eyes and went to sleep I would not wake.

All the moving around woke my husband and I actually still tried to talk him out of going to the emergency room as it was 2:30AM.  Our daughter was asleep and I did not want her to miss any school as she is having her nine weeks tests this week.  I didn’t want to wake the in laws at this hour especially since this could still have been something else.  I just did not want to burden anyone.  That is why I did not intentionally wake him.

But finally I gave into the fear and we went.  As I mentioned, I was lucky.  They repeated told me I did the right thing and diagnosed me with Costochondritis.  They mentioned it feels just like a heart attack.  If this had actually been my heart waiting all day to mention it ( well I guess I really did not mention it until almost 16 hours after that first pain shot through my chest) could have left my children motherless because I did not want to inconvenience anyone.

As a gender, we women are stubborn and not always as smart as we would like everyone to believe.  This could have turned out much differently and unfortunately for many has and probably will.  Moral of this story?  You never know.  Just go if only to ease your mind.  Think of the inconvenience of not being there you would cause your family instead of the few hours it takes to see a doctor.

Shamrock Half Marathon 2014 RR

This is my second favorite yearly race which I did for the first time in 2010.  The Wicked is my favorite.  The Shamrock after party is always awesome.  The volunteers for all of the J&A races are just so happy to be there and make you smile at times when you may be feeling exhausted and ready to quit.  It really makes a big difference to every runner that passes by them.  I will always muster up a smile and a thank you to each and every one of them.

This year was no different.  I had been looking forward to the bands, drinks and friends all running and gabbing together during the party.  Unfortunately my fate was sealed the day prior and I was not changing fate’s mind.

This is the first year that hubby has run a Shamrock and he decided to do the 8k.  So we get up around 4:30 AM and head out the door an hour later.  Luckily Saturday was very nice.  Cool enough during the race then warmed up for the after party.  It was very nice and odd for me to be a spectator.  But I enjoyed cheering everyone on from beginning to end instead of just after I cross the line.

Once we get home, I have dinner cooked by 5:00PM and am in bed by 7:00PM.  I have my alarm set for 3:00AM on Sunday to give myself an hour and a half to move around, eat a decent breakfast of toast with Nutella and a banana and drink some water.

We arrive and park and begin the walk to 42nd street.  My feet and both knees start to ache already.  This is a first.  Not quite sure why but I mentally chopped it up to mind tricks.  We hop in the corral and are off.

Before I even hit mile marker 1 my “first layer” of pants begin to fall to my hips.  WTHeck?  So I am running struggling not to look ridiculous trying to pull them up.  Then not 10 seconds after I get that straight my nano starts to fall off it’s clip and I am yet again struggling to keep that fastened.  All of this within the first mile.  And it does not stop here mind you.

I decide to take a quick walk break after mile 5 because my training the last couple of months has suffered due to all of the snow and ice and my new goal was to just finish the race upright.  After walking for 1 minute I slowly take back off only to find that I have trouble getting back in my groove.

Then my gut decides to put its two cents into the basket and around mile 7 inside of the base I stop at the porta potty.  Up to this point I was in the group with the 2:15 pacer.  I was doing an easy pace and not pushing at all, even with all that had happened up to this point.  This was a long set back.  15 minutes it took to stand in line and get back out there. As soon as I step out, here comes the 2:30 pacer.  I silently cursed and took off behind her.

Now after that long of a “cool down” I had to start all over with getting my breath under control and form back.  Now for those who ran this race note I said I stopped at the potty  line on the base.  This was at the entrance.  The next two miles the wind just kicked my butt.  This must have lead to me running oddly because my left knee started to join the destructive party.

So between the gut and my knee it continued throughout the remaining miles.  I had to take several walk breaks because the pain was just so intense.  I tried to pay close attention to my form and just when I thought it must really be sucking I was tapped on the shoulder.  I removed my ear plug so that I could hear the lady who had come up beside me.  She stated “you have the best running form I have ever seen.  I just wanted to tell you that”.  Running angel?  I can only imagine the look on my face as I gave her my thank you.

Not too long after we approached the clock around mile 11.50 and I noticed I could still hit a 2:30 if I just kept going like I was going, snail pace but forward.  But that was the positive push I desperately needed to put me back in the race mentally.

About .75 miles from the finish I had to walk again.  Blasted knee!  So I walked for a minute then approached that last water stop and just kept going through it.  Then I began to run again to finish out the boardwalk.

2:30:47

…even with all the trouble I had and the very very long pit stop.  It could have totally been worse so I will accept that time with only a little grudge.

The most unfortunate part of this whole day?  The after party with our group which I had been so looking forward to for months, I had to skip out on.  Once I crossed that line the stomach decided it was not done with me and we left immediately.  I slept the rest of the day through the night.  I also did not get any picture for this race.  My scrapbook page will be faceless (as well as this post).

Today I am giving all my attention to my long lost buddy, my foam roller.  I find walking to be way too painful.  Dern knee!  After almost a year and half of no IT Band issues it decided to hit me all at once during this race.  I guess it just did not like all the concrete and the sloped roads.  I usually do all of my long runs on crush and run and never have an issue.

Now I will just look forward to next year and concentrate on getting this knee better before the Flying Pirate Challenge coming up in May.

Eye VS the Dependent Ones

“Eye Twitch Chronicles”

You would think that after almost 40 years on this earth that not too many things would continue to leave me scratching at the walls of my safe house.  This group of people I have labeled “The Dependent Ones” just continues through the decades to set my fight or flight instincts into overdrive.

Who knows exactly how to handle these special people.  They want so much to run everything, to be the boss, the one that makes the decisions and has all the power, but that stands firm only so long as their feet stay dry with the all weather boots they are sporting around their house.  Don’t let even the tiniest of rain drops seep through that fabric because they just cannot seem to find where they hid the towels.  For that they will call in the calvary.

So the question then becomes, should the calvary buck the system and send them on a scavenger hunt for the towels they so expertly deny exists, run kicking and screaming into the hills for which we know they are just to lazy to climb or yet again give in and cater to their every whim?

The calvary really is not magical, we just seem to be able to look at a problem from many different sides and come to a conclusion.  This is no special skill that “The Dependent Ones” can not possess themselves.  They just refuse to tap into that unused pool of knowledge and turn the knob.

Be careful that you do not get swept inside of their house of mirrors because once you are in and only see You from all angles, you may forget that just around the corner is the calvary that has actually allowed you to stay safe inside of those boots.  And as you rest your head each night in the pillow of denial the calvary is fighting your battles and becoming extremely frustrated that common sense is becoming a rare trait.  This may one day at any sunrise cause them to turn and fire in your direction.

How should you really protect yourself?  Reject your membership and become dependent upon yourself.  Take small steps by first removing those water proof boots.  Dip your toes into the pool and then if you find yourself scratching the walls to get back inside, make the phone call.

The calvary actually enjoys assisting all groups, it is what we do.  However, if the group doesn’t at least try to individually assist, the wolf will become a reality because the line will be busy and the cry will not be heard.

Who needs a hit of adrenaline when you can walk down the street, through the halls or tune into any media and find “The Dependent Ones” closing in from all sides.  Zombie apocalypse beware, “The Dependent Ones” are already among us and the infection is rampant.

Eye Twitch source:  those too lazy to troubleshoot an issue they are fully capable of fixing but instead immediately escalate to the next tier and beyond

My First Yoga Challenge

I went into the doyouyoga.com 30 Day Challenge with Erin Motz with one thought; that it would help me improve my running by increasing my flexibility, ability to relax and reduce my stress level.  However, I found much more than expected.

Most of the routines included the downward facing dog position. I found this to become easier and easier to hold after a few weeks of the challenge.  In week three I decided to begin expanding my cross training to include weights again and hit the pull-up bar.  What I found instead of starting from scratch yet again I could actually do 6 with limited assistance.  Usually every time I start over I’m double footing it on a chair and doing more leg work than back and shoulders.

I also discovered that I did not have to begin push-ups on my knees.  I guess all of the sun salutations with a chaturanga actually built muscle.  I honestly did not expect this.  I guess in hindsight it should not have been a surprise.  You just generally do not think ‘muscle’ and ‘yoga’ together.  Man was I pleasantly proven wrong.

I believe a lot of people think taking a yoga class to be a waste of a good hour that they could otherwise be hitting cardio but let me be (probably not the ..) first one to tell you, I sweat buckets.  Even during the shorter 30 minutes sessions I squeeze in before work.

My advice for all the disbelievers?  Take a challenge like this one.  It was only 10-15 minutes per day and shows you in shorter spurts that yoga is the real deal and makes an excellent complementary activity regardless of your end goal.

PowerShell Remove Disabled Users From All Groups

As a follow up to my PowerShell Update Accounts from Multiple Domains post I needed to find a way to remove the student accounts which were in a non-active status from all security/distribution groups.  Each student may be in groups from multiple domains as well as the resource domain so each had to be addressed.  To do this I created a function to handle locating the group and using a switch statement to assign the domain controller to use for that particular group.

Let’s walk through it starting with the function:

Function GetGroup

{

Since the function is called during the meat and potatoes of the script for each domain, it will be passed data and therefore build an array of groups each user is a member of

$userGrps = $other.memberOf

Then for each group in that array, the global catalog is queried to pull the distinguishedName for each

foreach($grp in $userGrps)

{

$UADGroup = Get-ADGroup -Identity $grp -Server servername.dc.dc:3268 -Properties distinguishedName

$UADGroup | ForEach-Object -Process {

$DNGroup = $UADGroup.distinguishedName

} #end foreach-object

A switch statement using a wildcard is used to assign a domain controller for the domain each group belongs

switch -Wildcard ($DNGroup)

{

“*,OU=Groups,DC=XX,DC=XX” {$server = “servername.xx.xx”}

“*,DC=Child1,DC=XX,DC=XX” {$server = “servername.child1.xx.xx”}

“*,DC=Child2,DC=XX,DC=XX” {$server = “servername.child2.xx.xx”}

} #end switch

Then using each group with a usable domain controller, the remove-adgroupmember is used to remove the users in the $other array based on their group memberships in the $grp array.  If it is unable to remove the user it will print to the console the user’s DN and group to be removed from and the server that was attempted to troubleshooting.

Try

{

$grp | Remove-ADGroupMember -Members $other -Server $server -Confirm:$false

} #end try

Catch

{

Write-Host “Cannot remove $other from $UADGroup on $server”

} #end catch

}

Since this function will be called multiple times, we clean up the variables

$userGrps = $null

$DNGroup = $null

$UADGroup = $null

} #end Function

Now we will query Active Directory for any account in each domain using the ‘Title’ attribute.  You can use any filter to pull a certain subset of accounts but this is what was required for me.  We will also call the function, disable the account and move it to a specific organization unit.

#begin

$otherUsers = get-aduser -filter {((Title -eq “Drop”) -or (Title -eq “Cancel”) -or (Title -eq “Back Out”) -or (Title -eq “Suspension”)  -or (Title -eq “Leave of Absence”))} -Properties * -server Child1.XX.XX.XX -SearchBase “OU=Students,DC=XX,DC=XX,DC=XX”

foreach ($other in $otherUsers)

{

GetGroup($other)

disable-adaccount -identity $other

move-adobject -identity $other -targetpath “OU=DisabledUsers,DC=,DC=XX,DC=XX”

}

write-host “Resetting otherUsers”

$otherUsers = $null

Repeat that block of code for each domain in the forest starting at #begin

Powershell to Update Accounts in multiple domains

I have been searching and searching through articles and blogs and discussion forums for a way to accomplish my latest endeavor, a way to extract information from our student information system and populate the matching Active Directory accounts.

The issue I have run into from all of the aforementioned electronic stops is the fact that our forest has 18 domains.  Finding an easy way to update the accounts in one CSV file to an account which can be in any domain at any time has been quite a challenge.  However, I finally figured out a way that worked for me and thought I would share as I have not been able to find anything in the past four months that did the job in one swoop.

First off I setup my Windows 8 workstation by enabling the PowerShell 3.0 ISE 64bit console and the windows SQL Server 2008 R2 client tools.  The workstation is also located on a subnet which can access not only the SQL server of the SIS database but also one domain controller for every domain in our forest.  I was also provided with an account to the database which has the permission to read the tables for the data I need to extract and an account which has the ability to update all student Active Directory accounts.

I know this may sound IT101 but for those just stepping into these shoes, every little bit of knowledge which may be obvious to those of us seniors in the game is not to those just learning to walk.  And the one thing I have learned in the 13 years in this business is to never assume others know anything.

Once the workstation that will be running the script is all set and tested, open the 64bit ISE console.

First we must be able to make a connection to the SQL server and Active Directory.

import-module ActiveDirectory                                                                                         Add-PSSnapin SqlServerCmdletSnapin100                                                                 Add-PSSnapin SqlServerProviderSnapin100

Next we enter the t-sql used to query the SIS database and then export it to a CSV file (note: going into the sql code required for this is beyond this post)

$SQLquery =@”        

SQL code here                                                                                                                    “@ 

$result = invoke-sqlcmd -query $SQLquery -serverinstance “servername” -database dbname                                                                                                                          

$result | export-csv “C:\PSScripts\Update_Students.csv” -notypeinformation

Next we will import the CSV file and set the script to create a log file to review errors after the script completes.

$SyIDOutputFile = “C:\PSScripts\UpdateReport.log”                                                   $upn = import-csv “C:\PSScripts\Update_Students.csv”

Now that we’ve completed the setup, let’s get down to business.  We will setup the loop to handle each account in the CSV file and do some work.  Instead of throwing all at you at once, I’m going to continue to break it down so you will know what each line is actually doing.  This should make it easier for you to take this script and make it your own.

We create the ‘foreach’ loop then cycle through each line in the CSV file pulling the information we will need to use and setting it to a variable.

foreach ($u in $upn)                                                                                                                {                                                                                                                            $emailAddress = $u.email                                                                                           $stuNum = $u.StuNumber                                                                                       $empNumber = $u.StudentID

Now let’s query the Global Catalog for each student in the CSV file and pull the distinguished name attribute and assign to a variable.

$ADUser = get-adobject -Filter {mail -like $emailAddress} -server servername:3268 -Properties distinguishedName | select-object -property distinguishedName

$ADUser | ForEach-Object -process                                                                                   {                                                                                                                                            $dn = $ADUser.distinguishedName

Now we will need a Switch statement for each domain.   We will use a wildcard since the distinguished name for each user will contain the domain name but they may be in different organization units.  I have only included two entries below but you would need a statement for each domain in your forest.  You can also include other variables with each statement that pertains to that domain such as a specific display name, department, etc.  You are populating LDAP attributes and no longer just the ones available to the Global Catalog so the list is long of what you can include.  For simplicity we are just including the server which is needed to update that student account.

switch -Wildcard ($dn)

{

“*,DC=X1,DC=X,DC=X” {$server = “child1.X1.X.X”}

“*,DC=X2,DC=X,DC=X” {$server = “child2.X2.X.X”}

} #end switch

Now let’s take all of the information we have gathered and either update the account or write to the log file that it cannot be done listing the distinguished name reported and the server that was tried.  This should help troubleshoot those that could not be updated.

Try{

set-aduser -Identity $stuNum -employeeNumber $empNumber -server $server

Write-host “$stuNum $emailAddress will be set to $empNumber on $server”

} #end Try

Catch

{

write-warning “$stuNum does not exist on $server to be updated as $dn”

Out-File -FilePath $SyIDOutputFile -InputObject (“$stuNum does not exist on $server to be updated as $dn”) -Encoding UTF8 -append

}#end Catch

}#end foreach-object

}# end foreach

Now let’s send the log file to our account managers to review any errors that occurred during the script

write-host “End of Active Directory Updates”

#Send Log File via email

$SmtpServer = “enter ip address of smtp relay server”

$Smtp = New-Object Net.Mail.SmtpClient($SmtpServer)

$SmtpFile = New-Object Net.Mail.Attachment($SyIDOutputFile)

$SmtpMsg = New-Object Net.Mail.MailMessage

$SmtpMsg.From = “enter address to send email from”

$SmtpMsg.To.Add(“enter email address to send log to”)

$SmtpMsg.Subject = “Student Update Log”

$SmtpMsg.Body = “Attached is the latest student update log.”

$SmtpMsg.Attachments.Add($SmtpFile)

$Smtp.Timeout = “30000”

$Smtp.Send($SmtpMsg)

Lastly, let’s clean things up

#Clean up

$SmtpFile.Dispose()

remove-item “C:\PSScripts\Update_Students.csv”

remove-item “C:\PSScripts\UpdateReport.log”

And that’s it.  Now I do like to give credit where it is deserved.  The email portion which sends the log file I found in the Technet blogs from Roman Zarka pertaining to Office 365.  But it works regardless of what the script does and I have used it many times over.

I hope this will help the many I read entries from looking for the same solution.