Quantcast
Channel: Geekswithblogs.net
Viewing all 6441 articles
Browse latest View live

Case Study on Importance of Clear Contest Rules (But Matthew Good Is Still Awesome)

$
0
0

Originally posted on: http://geekswithblogs.net/dlussier/archive/2015/11/23/169026.aspx

Part of running a conference, or a trade booth at a conference, is holding contests for prizes. While this may seem trivial in its execution, its very important that you think through and communicate the rules of said contest - otherwise you could have some very unhappy participants. Let me give you an example.

Tonight I'm heading to the Matthew Good concert which I'm pretty pumped about. He's doing a contest at every stop by showing a landmark and getting fans to rush to the spot and post a pic of themselves - the winner gets a VIP upgrade to meet him along with some swag. So when they showed the location as The Forks, it was on! According to Twitter I was the first one to post a pic!

I guess it was just time to wait to find out if I was the first one to post, after all the rules said...


I noticed after lunch some other guy that had posted his pic well after me was tweeted as the winner?! This didn't make sense...and there were two other people who had tweeted @mattgood with their pics at the location as well before the "winner". 

Let's look at the #6 rule from the contest rules though...


I underlined the part about the Hashtag - that, it turns out, was the difference - the tweet had to include #chaoticneutraltour. I was 19 characters away from getting to meet Matt, which would have been awesome.

The problem with this is that the rules aren't clear. In #5 it says all you have to do to win is be the first person to find the location and take a picture. The next one (#6) tells you where to post to prove you were there. But the verbiage around the hashtag part is anemic. It should have said...

"You MUST ALSO include the hashtag..."

Here's what probably pisses me off the most about this - its less about giving something interesting for the fans and more to do with promoting the tour on social media. Ironically the guy that won seemed to create his Twitter account *just* for this contest so any social media reach they hoped to gain from this is nulled.

Is this sour grapes as my new best Twitter friend Aaron (@octobermidnight) suggests? It's more of an annoyance really. And here's where the lessons learnt come in...

People's Time is Valuable
Any time that you do a promotion that requires people give of their time, they are GIVING SOMETHING. Whether its taking a picture at a location, having them fill out an online form, or submitting a session survey, they are giving something of themselves.

Make The Rules Crystal Clear
We all hate legalese, but being too laid back with contest rules can be disastrous. If participants need to do certain things to enter, then explicitly state what they must do. And use that word MUST, otherwise it can be open to interpretation. "Don't forget to..." isn't strong enough. Don't be cute, be specific.

If Possible, Include All Participants
A great idea is to offer something to all participants regardless if they win. This validates and thanks them for giving of their time (which is valuable) and for helping you reach whatever your goals were by doing the promotion (creating a contact list, getting something out on social media, getting a product name out, whatever). This could be anything - discount offer, small branded item, etc.

Try to Avoid First-In and Win
The problem with the first person doing whatever being the winner is that there's no incentive for others to participate. For instance, if your goal is to get as much exposure on social media, why would you not want as many people as possible active online with your accounts/hashtag? Better to give a time span to let everyone who wants to participate have a chance and then draw from that.

So be clear in your rules and you and your participants will have a great time running your contest!

So About The Concert....
Now is the fact that I won't get to meet Matt going to ruin my entire night? Not at all! Matt will be awesome belting out old and new tunes, I'm going to pick up one of those swanky Chaotic Neutral t-shirts with the D20 on it, and leave having had an awesome time listening to one of the great Canadian musicians of our time.

His PR/Social Media team though? Well they rolled a natural 1 on this one.



Microsoft Developer Roadshow Sweden with Active Solution

$
0
0

Originally posted on: http://geekswithblogs.net/jakob/archive/2015/11/24/microsoft-developer-roadshow-sweden-with-active-solution.aspx

image

 

This december we at Active Solution team up with Microsoft Sweden to deliver a full day of Azure and Internet of Things (IoT) goodness in 4 different cities around Sweden:

  • Malmö– Dec 1
  • Göteborg– Dec 2
  • Umeå– Dec 8
  • Stockholm– Dec 9


This is a unique opportunity for devlopers, startups and students that want to learn more about what Microsoft Azure has to offer and how you can implement IoT solutions together with Azure.

The day will be a mixture of sessions, discussions and hands-on labs where you will have the chance to try out these technologies in practice, just bring your Windows 10 laptop with Visual Studio 2015 and the Azure SDK installed,
and make sure that you also have an active Azure subscription (an evaluation subscription will be fine)

From Active Solution, myself and Robert Folkesson will host the second part of the day, where we will guide you through the hands-on labs.

Read more and sign up for the event at http://devroadshow.net/

 

Image result for microsoft azure

 

Hope to see you there!

Fix Generating Task failed in Visual studio 2015 Update 1 RC

$
0
0

Originally posted on: http://geekswithblogs.net/anirugu/archive/2015/11/24/fix-generating-task-failed-in--visual-studio-2015-update.aspx

If you compile your winform project (regardless to target version of .net framework) and it’s can’t be compiled on another machine (which don’t have update 1 RC as yours) then here is the trick to fix it.

 

Delete Every obj folder in root of every projects. if you have multiple project then consider this stackoverflow post to do it faster http://stackoverflow.com/questions/755382/i-want-to-delete-all-bin-and-obj-folders-to-force-all-projects-to-rebuild-everyt


Now when you done after delete all obj folder you can simply click F5 and it will be run fine.

 

Smile

Fix slow nuget operation in Visual studio 2015

$
0
0

Originally posted on: http://geekswithblogs.net/anirugu/archive/2015/11/24/fix-slow-nuget-in-visual-studio-2015.aspx

If your visual studio run too slow for download the nuget package that is common to the most project you build in daily rutine then you can follow same trick as 2013.

open the local appdata folder by this

%userprofile%\appdata\locallow

open the nuget > cache folder and add it to

Tools > options > Package source > Add it here and next time choose Offline for package source and you can save your time and bandwidth both.

Best Post I've Found... Netatalk 3 setup guide

Microsoft Connect 2015 – Unveil the future of an open source .NET on Linux and Mac

$
0
0

Originally posted on: http://geekswithblogs.net/Jialiang/archive/2015/11/25/microsoft-connect-2015-ndash-unveil-the-future-of-an-open.aspx

image

A year ago Connect(); started the journey for a new Microsoft for developers, unveiling the future of an open source .NET on Linux and Mac, and a free Visual Studio for targeting any device and any OS.

Join us this year to hear directly from Scott Guthrie, Brian Harry, and Scott Hanselman on what’s next in this exciting journey. Get deeper insights into our exciting announcements with over 80 on-demand sessions. Interact with the engineering team members behind Microsoft tools and technologies to help you get started.

http://codechannels.com/event/channel9/connect-2015/ 

Scott Guthrie’s Keynote: The Future of Microsoft Tools and Services for the New Role of Developers

Scott Guthrie’s Keynote: The Future of Microsoft Tools and Services for the New Role of Developers

The role of the developer is dramatically changing in today’s world, and so is Microsoft. A year ago we started the journey for a new Microsoft for developers, unveiling the future of an open source .NET on Linux and Mac, and a free Visual Studio for targeting any device and any OS. In this keynote […]

 

Brian Harry’s Keynote: Microsoft Development Services for the DevOps Era

Brian Harry’s Keynote: Microsoft Development Services for the DevOps Era

Welcome to the age of extraordinary expectations! Nowadays, every application must work flawlessly, seamlessly, and elegantly on every device, all the time. In the DevOps era, people, processes and tools are all essential for success and teams of any size need to collaborate to deliver continuous value. In this demo-heavy session, Brian Harry – VP […]

 

Scott Hanselman’s Keynote: The Microsoft Cloud Platform for Developers

Scott Hanselman’s Keynote: The Microsoft Cloud Platform for Developers

Just a command line or a click away – you now have the power to tap into dozens of global data centers and enact your will.  Publish a website in seconds on Azure App Service, add Machine Learning intelligence with a couple of API calls, connect your "internet of things" or roll your own web …

Azure Sketchnote Collection: Part 2

Best Post for Configuring Avahi


So this is nice....

Can’t see all your OneDrive files in Windows Explorer?

$
0
0

Originally posted on: http://geekswithblogs.net/ihaynes/archive/2015/11/27/canrsquot-see-all-your-onedrive-files-in-windows-explorer.aspx

An app I have on my Windows Phone allows me to back up data to my OneDrive account. I hadn’t used this for several months and when I did and opened OneDrive in Windows Explorer, it didn’t seem to have written anything to OneDrive. I contacted the app developer but he didn’t have any suggestions as to what might be wrong.

It then occurred to me to log onto OneDrive via a browser and voila, the new files were visible. Strange.

Looking on the net I found lots of people with the same problem and eventually found a solution, which was to create a network drive pointing to the OneDrive account. That done, all the files are visible, locally, without taking any storage space on the local machine.

To see the full description of the solution see this video from Sean Ong on YouTube.

Thanks Sean!

Secure Collaboration with External Users in Office 365

$
0
0

Originally posted on: http://geekswithblogs.net/PointsToShare/archive/2015/11/27/169239.aspx


Office 365 SharePoint on line allows the owners to collaborate with outside users while limiting their access to just the right resources.

Unlike internal users for whom you have to purchase licenses, external users are free. You only pay for the extra storage generated by your expanded activity and even then only when you have crossed your allotted space

Microsoft is not exactly renowned for its intuitive navigation, and this subject does not break the mold - is not well explained by Microsoft so in the next 3 posts (including this one), I will guide you through the process and explore the option.

The process is done in 4 steps:

  • Create a sub-site (or sub-sub-site) dedicated to a client, or project – the place where the collaboration will take place – NEVERinvite External user to your main page

  • Set the permission levels for different user groups within the site. The Members permissions are a bit too permissive for my taste

  • Invite the external users to the sub site

  • Do the work – I will not expound on this part of the process

 

Step 1: Create a sub-site

Creating a sub-site is as easy as 1-2-3 (or shall I say excel?) but one must pay attention to one important point – Breaking Security Inheritance. You must use unique permissions or else you become vulnerable.


Out of the box, a new sub-site comes with a set of permissions that are a bit too lax for my taste. In my next post, I will show you how to overcome these issues. 

 

 

Secure Collaboration with External Users in Office 365

$
0
0

Originally posted on: http://geekswithblogs.net/PointsToShare/archive/2015/11/27/169240.aspx


Office 365 SharePoint on line allows the owners to collaborate with outside users while limiting their access to just the right resources.

Unlike internal users for whom you have to purchase licenses, external users are free. You only pay for the extra storage generated by your expanded activity and even then only when you have crossed your allotted space

Microsoft is not exactly renowned for its intuitive navigation, and this subject does not break the mold - is not well explained by Microsoft so in the next 3 posts (including this one), I will guide you through the process and explore the option.

The process is done in 4 steps:

  • ~Create a sub-site (or sub-sub-site) dedicated to a client, or project – the place where the collaboration will take place – NEVERinvite External user to your main page

  • Set the permission levels for different user groups within the site. The Members permissions are a bit too permissive for my taste

  • Invite the external users to the sub site

  • Do the work – I will not expound on this part of the process

 

Step 1: Create a sub-site

Creating a sub-site is as easy as 1-2-3 (or shall I say excel?) but one must pay attention to one important point – Breaking Security Inheritance. You must use unique permissions or else you become vulnerable.


Out of the box, a new sub-site comes with a set of permissions that are a bit too lax for my taste. In my next post, I will show you how to overcome these issues.

 

 

Teaser: Hierarchical Scrum – How to Introduce Scrum Step by Step

$
0
0

Originally posted on: http://geekswithblogs.net/theArchitectsNapkin/archive/2015/11/27/teaser-hierarchical-scrum-ndash-how-to-introduce-scrum-step-by.aspx

Not all practices are created equal, I’d say. That became clear to me again while reading “Scrum: The Art of Doing Twice the Work in Half the Time” by Jeff Sutherland.

Even though I’ve grown somewhat skeptical of the Agile silver bullet Scrum and find some of what Jeff Sutherland wrote an exaggeration and a bit heavy on the side of self-praise, I still like the book. I can recommend it, especially to non-developer people of all trades.

What the book made me think of was a kind of hierarchy of Scrum practices. Some of it to me simply is more important than the other.

[Read on in my new blog…]

New RSS Feeds

Since October 2015 I write all my new blog articles in a consolidated blog right on my homepage at ralfw.de.

If your want to be notified automatically about new postings, please subscribe to one of the following RSS feeds or follow me on Twitter.

Coexistence between Exchange forests (without trusts…) -- Part 11: References & Sync Script

$
0
0

Originally posted on: http://geekswithblogs.net/marcde/archive/2015/11/30/coexistence-between-exchange-forests-without-trustshellip-----part-11.aspx

· How to license FIM 2010 & MIM 2016
http://social.technet.microsoft.com/wiki/contents/articles/2487.how-to-license-fim-2010-and-mim-2016.aspx

· Global address list synchronization walkthrough:
https://technet.microsoft.com/en-us/library/cc708642(v=ws.10).aspx

 

Scripts

I did not write these scripts myself, found them only on https://social.technet.microsoft.com/Forums/en-US/c7e204be-05b4-40e1-bf95-e0191a76ece3/using-powershell-to-start-run-profiles?forum=ilm2. Going through them, they get the job done and are synchronizing the directories in my lab happily Smile.

Start-sync.ps1

#@author: Lance Hext

#@mail: lhext@h-cp.us

#############################################################################################

# PARAMETERS #

#############################################################################################

# #

# $debug #

# debug on = $true; #

# Debug off = $false; #

# #

#############################################################################################

#

$debug = $false;

#

#############################################################################################

# #

# $SequenceInfo #

# Place some meaningful information for display at the #

# beginning of the squ3nce #

# #

#############################################################################################

#

$SequenceInfo = "Hourly Synchronization Sequence"

#

#############################################################################################

# #

# $params_ComputerName #

# The name of the server running FIM #

# Use "." if running on the PowerShell script on the FIM server #

# #

#############################################################################################

#

$params_ComputerName = "."

#

#############################################################################################

# #

# $params_delayBetweenExecs #

# delay between each execution, in seconds #

# 1 Minute = 60 #

# 10 Minutes = 600 #

# 15 Minutes = 900 #

# 30 Minutes = 1800 #

# 1 Hour = 3600 #

# #

#############################################################################################

#

$params_delayBetweenExecs = 0

#

#############################################################################################

# #

# $params_numOfExecs #

# The number of executions the script will run before terminating #

# 0 for infinite #

# #

#############################################################################################

#

$params_numOfExecs = 1

#

#############################################################################################

# RUN Profile Sequence Section #

# #

# The array below contains the MA run sequence order #

# #

# Format #

# @{ #

# name=""; #

# profilesToRun=@(""); #

# }; #

# #

#############################################################################################

#

## Addition Info :: Author: Ethan Turk

## Change Info 1: Added to set thresholds for maximum number of changes

## which are allowed in a single run step. You can set individual limits

## for add, updates or deletes.

##

## Ex: Add 'addthreshold=100;', 'delthreshold=100;' or 'updthreshold=1000;' to the

## cycle step below.

## See the 'AD MA' Export step below.

##

## Change Info 2: Added ability to set a mandatory sleep for individual

## sync cycle steps instead of a sleep for the whole set of steps.

##

## Ex: Add 'sleep=120;' to the cycle step below.

## See the 'FIM MA' Delta Import step below.

? Note: Adapt the below names to match the names of the Synchronization agents created in MIM. The names must match exactly!

$params_runProfilesOrder =

@(

@{

name="UK GALMA - EX2007";

profilesToRun=@("Delta Synchronization");

};

@{

name="US GALMA - Exchange 2010";

profilesToRun=@("Delta Synchronization");

};

@{

name="UK GALMA - EX2007";

profilesToRun=@("Export");

};

@{

name="Us GALMA - Exchange 2010";

profilesToRun=@("Export");

};

@{

name="UK GALMA - EX2007";

profilesToRun=@("Delta Import");

};

@{

name="US GALMA - Exchange 2010";

profilesToRun=@("Delta Import");

};

);

#

#############################################################################################

# EMAIL PARAMETERS #

#############################################################################################

# #

# $UseEmailCreds #

# Directs the PowerShell script to send Using Credentials #

# $true; = Send email with Creds #

# $false; = Send email without Creds #

# #

#############################################################################################

#

$UseEmailCreds = $false;

#

#############################################################################################

# #

# $emailFrom #

# A Well formatted email address for the FIM Server #

# Example "FIMSequencer@xyz.com" #

# #

#############################################################################################

#

$emailFrom = "SentFrom@yourdomain.com"

#

#############################################################################################

# #

# $emailTo #

# A Well formatted email address for Recipient of the email #

# Example "someone@xyz.com" #

# #

#############################################################################################

#

$emailTo = "AdminEmail@yourdomain.com"

#

#############################################################################################

# #

# $emailCC #

# A Well formatted email address for send a Copy of the email to #

# Example "carboncopy@xyz.com" #

# #

#############################################################################################

#

$emailCC = ""

#

#############################################################################################

# #

# $emailCC1 #

# A Well formatted email address for send a Copy of the email to #

# Example "carboncopy@xyz.com" #

# #

#############################################################################################

#

$emailCC1 = ""

#

#############################################################################################

# #

# $smtpServer #

# A FQDN of a mail server #

# Example "mail.xyz.com" #

# #

#############################################################################################

#

$smtpServer = "your SMTP Server"

#

#############################################################################################

# #

# $EmailperMA #

# Directs the PowerShell script to either send an email at the completion #

# of each MA OR generate One email at the end of the sequence run #

# #

# $true; = Send an email for each MA #

# $false; = Send 1 (one) email at the completion on the Sequence #

# #

#############################################################################################

#

$EmailperMA = $false;

#

#############################################################################################

# #

# $EmailOnErrorOnly #

# Directs the PowerShell script to send and email on failues only #

# $true; = Send email only on an MA Sync Failure ie MA.Result <> "success" #

# $false; = Send email when MA finishes #

# #

#############################################################################################

#

$EmailOnErrorOnly = $false;

#

#############################################################################################

# #

# INCLUDE THE PROGRAM #

# #

# Location of the Actual Program. This can be a relative or physical path #

# #

# NOTE the 1st period is required #

# Examples #

# Physical Path #

# .C:\powershell\RunSequencerProg.ps1 #

# Relative Path #

# ..\RunSequencerProg.ps1 #

# #

#############################################################################################

#

.\RunSequencerProg.ps1

 

RunSequencerProg.ps1

#################################################################################################################################

# FIM 2010 Management Agent Runner #

# Author : Lance Hext #

# Mail : lhext@h-cp.us #

# Version : 1.2.3 #

# Information : This PowerShell script executes an array of managements agents supplied form the calling PowerShell #

# script. This PowerShell script utilizes the FIM wmi interface for the execution and statistics #

# gathering. #

# For each Management executed either a single email is generated per management agent #

# or a combined email is generated which will contain all the statistic from the run. #

# The email contains the following information as part on the email body #

# 1: The Management agent name #

# 2: The Management Agent completion status #

# 3: All Connector space statistics #

# 4: All Inbound Metaverse statistics #

# 5: All Export data counts #

# The email contains the following attachments #

# 1: The complete run history xml #

# 2: All inbound synchronization errors #

# 3: All Exported synchronization errors #

# #

# #

# #

#################################################################################################################################

# #

# START OF POWERSHELL SCRIPT #

# #

#################################################################################################################################

# #

# * * * * * * * * * * * D O N O T M O D I F Y B E L O W * * * * * * * * * * * * * #

# __________________________________ #

# #

#################################################################################################################################

#################################################################################################################################

# START OF FUNCTIONS #

#################################################################################################################################

$line = "-----------------------------"

function Write-Output-Banner([string]$msg)

{

Write-Output $line,("- "+$msg),$line

}

#################################################################################################################################

# END OF FUNCTIONS #

#################################################################################################################################

# START OF DATA #

#################################################################################################################################

$MAs = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $params_ComputerName)

$numOfExecDone = 0

$SendEmails = $true;

#################################################################################################################################

# END OF DATA #

#################################################################################################################################

# START OF PROGRAM #

#################################################################################################################################

Write-Output-Banner($SequenceInfo)

do

{

Write-Output-Banner("Execution #:"+(++$numOfExecDone))

if (!$EmailperMA)

{

$smtp = new-object Net.Mail.SmtpClient($smtpServer)

$smtpmsg = new-object Net.Mail.MailMessage

$smtpmsg.From = $emailFrom

$smtpmsg.To.Add($emailTo)

if ($emailCC)

{

$smtpmsg.Cc.Add($emailCC)

}

if ($emailCC1)

{

$smtpmsg.Cc.Add($emailCC1)

}

$RunStart = Get-Date

$AllRunTimeStart = Get-Date -uformat "%Y%m%d%I%M%S"

$smtpmsg.Subject = "FIM Run Sequence Results Started : " +$RunStart

$smtpbody = "

$smtpbody += "

"

$smtpbody += "

FIM Processing Results"

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email Create Mail Object"

Write-Output ($dbugmsg)

}

$AllRuns = "AllRuns-" + $AllRunTimeStart + ".xml"

$AllImportErrorRuns = "AllRuns-" + $AllRunTimeStart + "-ImportErrors.csv"

$AllExportErrorRuns = "AllRuns-" + $AllRunTimeStart + "-ExportErrors.csv"

}

foreach($MATypeNRun in $params_runProfilesOrder)

{

$found = $false;

$SendEmails = $true;

foreach($MA in $MAS)

{

if(!$found)

{

if($MA.Name.Equals($MATypeNRun.name))

{

$abortnow = $false

$found=$true;

$maname = $MA.Name

Write-Output-Banner("MA Name: "+$MA.Name,"`n- Type: "+$MA.Type)

foreach($profileName in $MATypeNRun.profilesToRun)

{

## Added 01/23/2012 :: Author: Ethan Turk

## Change Info: Added to allow sleeping for individual Sync Cycle

## Steps instead of a sleep which must run for every step.

if($MATypeNRun.sleep -gt 0) {

"Found Sleep. Sleeping for " + $MATypeNRun.sleep + " seconds" | Out-Host

Start-Sleep -Seconds $MATypeNRun.sleep

}

## End Addition

## Added 03/05/2012 :: Author: Ethan Turk

## Change Info: Added to set thresholds for maximum number of changes

## which are allowed in a single run step. You can set individual limits

## for add, updates and deletes.

$abortthreshold = "Threshold Reached on $maname $profileName. Cancelling run cycle..."

if($MATypeNRun.addthreshold) {

$ttype = "Add"

$addstatus = .\FIM_ActionThresholds.ps1 $MA.Name $ttype $MATypeNRun.addthreshold

if($addstatus) {

$abortnow = "$ttype $abortthreshold"

break

}

}

if($MATypeNRun.updthreshold) {

$ttype = "Update"

$updstatus = .\FIM_ActionThresholds.ps1 $MA.Name $ttype $MATypeNRun.updthreshold

if($updstatus) {

$abortnow = "$ttype $abortthreshold"

break

}

}

if($MATypeNRun.delthreshold) {

$ttype = "Delete"

$delstatus = .\FIM_ActionThresholds.ps1 $MA.Name $ttype $MATypeNRun.delthreshold

if($delstatus) {

$abortnow = "$ttype $abortthreshold"

break

}

}

## End Addition

Write-Output ("Run Profile "+$profileName,"`n -> starting")

$RunTimeStart = Get-Date -uformat "%Y%m%d%I%M%S"

$datetimeBefore = Get-Date;

$result = $MA.Execute($profileName);

$datetimeAfter = Get-Date;

$duration = $datetimeAfter - $datetimeBefore;

# Setup SMTP Message

if($EmailperMA)

{

if ($debug)

{

$dbugmsg = "--> DB ---- In Multiple Email Create new Mail Object"

Write-Output ($dbugmsg)

}

$smtp = new-object Net.Mail.SmtpClient($smtpServer)

if ($UseEmailCreds)

{

$smtp.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

}

$smtpmsg = new-object Net.Mail.MailMessage

$smtpmsg.From = $emailFrom

$smtpmsg.To.Add($emailTo)

if ($emailCC)

{

$smtpmsg.Cc.Add($emailCC)

}

$smtpbody = "

$smtpbody += "

"

$smtpbody += "

FIM Processing Results"

#$smtpbody += "

"

$smtpbody += "

Forefront Identity Manager Management Agent Run Results for: " + $MA.Name +"
"

$smtpbody += "

"

$smtpbody += "

"

$smtpmsg.Subject = "FIM Management Agent - " + $MA.Name

if("success".Equals($result.ReturnValue))

{

$msg = "Done. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds

$smtpmsg.Subject += " Processing Success"

$smtpbody += "

"

if ($EmailOnErrorOnly)

{

$SendEmails = $false;

}

}

else

{

$msg = "Done with Error. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds +" - Error: "+$result

$smtpmsg.Subject += " Processing Error"

$smtpbody +="

"

$smtpbody +="

"

}

}

else

{

$smtpbody += "

Forefront Identity Manager Management Agent Run Results
 
 
" + $MA.Name +" Completed Successfully
" + $MA.Name +": Completed.
MA Synchronization Status: " + $result.ReturnValue + "
"

$smtpbody += "

"

$smtpbody += "

"

if("success".Equals($result.ReturnValue))

{

$msg = "Done. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds

$smtpbody += "

"

$smtpbody += "

"

if ($EmailOnErrorOnly)

{

$SendEmails = $false;

}

}

else

{

$msg = "Done with Error. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds +" - Error: "+$result

$smtpbody += "

"

$smtpbody += "

"

}

$SendEmails = $true

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email : New Table "

Write-Output ($dbugmsg)

}

}

# Problems with RunHistory WMI not working with MaGuid or MaName, so I used RunDetails from the MA.

# $RunHistory = get-wmiobject -class "MIIS_RunHistory" -namespace "root\MicrosoftIdentityIntegrationServer" -filter("MaGuid='" + $MA.guid + "'")

# # Write the RunHistory file XML out to a file to then attach to the e-mail, and also set it to a XML attribute.

# $RunHistory[1].RunDetails().ReturnValue | Out-File RunHistory.xml

# Grab the first run-history, which always is the latest result.

# [xml]$RunHistoryXML = $RunHistory[1].RunDetails().ReturnValue

#Take the MA RunDetails RunHistory XML and write to file.

$RunHistFileName = $MA.Name + "-" + $RunTimeStart +"-RunHistory.xml"

$ImportErrorUserFileName = $MA.Name + "-" + $RunTimeStart + "-ImportErrors.csv"

$ExportErrorUserFileName = $MA.Name + "-" + $RunTimeStart + "-ExportErrors.csv"

$MA.RunDetails().ReturnValue | Out-File $RunHistFileName

# Grab the MA run-history and put it into a XML var.

[xml]$RunHistoryXML = $MA.RunDetails().ReturnValue

[xml]$RunHistory1XML = $MA.RunDetails().ReturnValue

# Build User Errors for Exports

$RunHistoryXML."run-history"."run-details"."step-details"."synchronization-errors"."import-error" | select dn,"error-type" | export-csv $ImportErrorUserFileName

$RunHistoryXML."run-history"."run-details"."step-details"."synchronization-errors"."export-error" | select dn,"error-type" | export-csv $ExportErrorUserFileName

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# Discovery Counters #

#################################################################################################################################

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/ma-discovery-counters/filtered-deletions")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/ma-discovery-counters/filtered-objects")

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# Staging Counters #

#################################################################################################################################

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-no-change")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-update")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-delete")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-delete-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-failure")

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# MV Inbound Counters #

#################################################################################################################################

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-remains")

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-projected-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-projected-no-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-joined-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-joined-no-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-flow-remove-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-delete-leave-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/flow-failure")

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-no-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-filtered-leave-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-filtered-remove-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-delete-add-processed")

$smtpbody += "

"

# $mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-projected-remove-mv")

# $smtpbody += "

"

# $mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-joined-remove-mv")

# $smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-update")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-rename")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-delete")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-delete-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-failure")

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# Outbound Counters #

#################################################################################################################################

$outboundCounters=$RunHistory1XML.SelectNodes("run-history/run-details/step-details/outbound-flow-counters")

foreach($outboundCounter in $outboundCounters)

{

$mvValue = $outboundCounter.ma

if ($debug)

{

Write-Output ($outboundCounter)

Write-Output ($mvValue)

}

$smtpbody += "

"

$mvValue = $outboundCounter.SelectSingleNode("provisioned-add-flow")

$smtpbody += "

"

$mvValue = $outboundCounter.SelectSingleNode("provisioned-disconnect")

$smtpbody += "

"

$mvValue = $outboundCounter.SelectSingleNode("connector-flow")

$smtpbody += "

"

$smtpbody += "

"

}

$smtpbody += "

"

$smtpbody += "

Forefront Identity Manager Management Agent Run Results
 
 
" + $MA.Name +" Completed Successfully
MA Synchronization Status: " + $result.ReturnValue + "
" + $MA.Name +": Completed.
MA Synchronization Status: " + $result.ReturnValue + "
 
 
" + $MA.Name + " Run Statistics
 
MA Run Profile:" + $profileName+"
Start Date & Time:" + $MA.RunStartTime().ReturnValue + "
End Date & Time:" + $MA.RunEndTime().ReturnValue + "
Total Run Time:"+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds + "
 
Connector Space Statistics
Total Connector Space Objects:" + $MA.NumCSObjects().ReturnValue +"
Total Connectors:" + $MA.NumTotalConnectors().ReturnValue +"
Connectors:" + $MA.NumConnectors().ReturnValue +"
Explicit Connectors:" + $MA.NumExplicitConnectors().ReturnValue +"
Total Disconnectors:" + $MA.NumTotalDisconnectors().ReturnValue +"
Disconnectors:" + $MA.NumDisconnectors().ReturnValue +"
Explicit Disconnectors:" + $MA.NumExplicitDisconnectors().ReturnValue +"
Total Placeholders:" + $MA.NumPlaceholders().ReturnValue +"
Total Placeholders:" + $MA.NumPlaceholders().ReturnValue +"
 
Discovoery Statistics
Filtered Deletions" + $mvValue.InnerText +"
Filtered Objects:" + $mvValue.InnerText +"
 
Stage Import Statistics
Import Stage Unchanged:" + $mvValue.InnerText +"
Import Stage Add:" + $mvValue.InnerText +"
Import Stage Updates:" + $mvValue.InnerText +"
Import Stage Deletes:" + $mvValue.InnerText +"
Import Stage Delete-Adds:" + $mvValue.InnerText +"
Import Stage Failures:" + $mvValue.InnerText +"
 
Inbound Statistics
Disconnectors
Filtered Disconnectors:" + $MA.NumFilteredDisconnectors().ReturnValue +"
Disconnectors" + $mvValue.InnerText +"
 
Metaverse
Projections - With Flow Updates:" + $mvValue.InnerText +"
Projections - Without Flow Updates:" + $mvValue.InnerText +"
Joins - With Flow Updates:" + $mvValue.InnerText +"
Joins - Without Flow Updates:" + $mvValue.InnerText +"
Deleted Metaverse Objects" + $mvValue.InnerText +"
Disconnected Metaverse Objects" + $mvValue.InnerText +"
Metaverse Flow Failures" + $mvValue.InnerText +"
Connector Objects
Connector With Flow Updates:" + $mvValue.InnerText +"
Connector Without Flow Updates:" + $mvValue.InnerText +"
Connector Filtered" + $mvValue.InnerText +"
Connector Filtered Deleted" + $mvValue.InnerText +"
Connector Delete-Add" + $mvValue.InnerText +"
Metaverse Disconnectors Projected" + $mvValue.InnerText +"
MV Deleted - Joined Disconnectors" + $mvValue.InnerText +"
 
Export Statistics
Export Adds" + $mvValue.InnerText +"
Export Updates" + $mvValue.InnerText +"
Export Renames" + $mvValue.InnerText +"
Export Deletes" + $mvValue.InnerText +"
Export Delete-Adds" + $mvValue.InnerText +"
Export Failures" + $mvValue.InnerText +"
 
OutBound Statistics for: " + $mvValue + "
Provisioning Adds:" + $mvValue.InnerText +"
Provisioning Disconnect:" + $mvValue.InnerText +"
Export Attribute Flow:" + $mvValue.InnerText +"
 
 
"

# Write-Output ( $smtpbody )

if($EmailperMA)

{

if ($debug)

{

$dbugmsg = "--> DB ---- In Multiple Email Send"

Write-Output ($dbugmsg)

}

$RHFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $RunHistFileName)

$smtpmsg.Attachments.Add($RHFile)

$IUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $ImportErrorUserFileName)

$smtpmsg.Attachments.Add($IUFile)

$EUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $ExportErrorUserFileName)

$smtpmsg.Attachments.Add($EUFile)

$smtpmsg.Body = $smtpbody

$smtpmsg.IsBodyHTML = $true

if ($SendEmails)

{

$smtp.Send($smtpmsg)

}

$RHFile.Dispose()

$IUFile.Dispose()

$EUFile.Dispose()

remove-item $RunHistFileName

remove-item $ImportErrorUserFileName

remove-item $ExportErrorUserFileName

}

else

{

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email Conat files"

Write-Output ($dbugmsg)

}

cat $RunHistFileName > $AllRuns

cat $ImportErrorUserFileName > $AllImportErrorRuns

cat $ExportErrorUserFileName > $AllExportErrorRuns

remove-item $RunHistFileName

remove-item $ImportErrorUserFileName

remove-item $ExportErrorUserFileName

}

Write-Output (" -> "+$msg)

Write-Output (" -> "+$result.ReturnValue)

}

}

}

if($abortnow) { break }

}

if(!$found -and !$abortnow)

{

Write-Output ("Not found MA Name:"+$MATypeNRun.name);

}

}

if($abortnow) { $abortnow | Out-Host }

$continue = ($params_numOfExecs -EQ 0) -OR ($numOfExecDone -lt $params_numOfExecs)

if($continue)

{

Write-Output-Banner("Sleeping "+$params_delayBetweenExecs+" seconds")

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email SLEEP Send"

Write-Output ($dbugmsg)

}

if(!$EmailperMA)

{

$smtpbody = "" + $abortnow +

"

" + $smtpbody

$RHFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllRuns)

$smtpmsg.Attachments.Add($RHFile)

$IUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllImportErrorRuns )

$smtpmsg.Attachments.Add($IUFile)

$EUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllExportErrorRuns )

$smtpmsg.Attachments.Add($EUFile)

$smtpmsg.Body = $smtpbody

$smtpmsg.IsBodyHTML = $true

if ($SendEmails -and $abortnow)

{

$smtp.Send($smtpmsg)

}

$RHFile.Dispose()

$IUFile.Dispose()

$EUFile.Dispose()

remove-item $AllRuns

remove-item $AllImportErrorRuns

remove-item $AllExportErrorRuns

}

Start-Sleep -s $params_delayBetweenExecs

}

else

{

Write-Output ("******************************")

}

}

while($continue)

if(!$EmailperMA)

{

$smtpbody = "" +

$abortnow + "

" + $smtpbody

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email Send"

Write-Output ($dbugmsg)

}

$RHFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllRuns)

$smtpmsg.Attachments.Add($RHFile)

$IUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllImportErrorRuns )

$smtpmsg.Attachments.Add($IUFile)

$EUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllExportErrorRuns )

$smtpmsg.Attachments.Add($EUFile)

$smtpmsg.Body = $smtpbody

$smtpmsg.IsBodyHTML = $true

if ($SendEmails -and $abortnow)

{

$smtp.Send($smtpmsg)

}

$RHFile.Dispose()

$IUFile.Dispose()

$EUFile.Dispose()

remove-item $AllRuns

remove-item $AllImportErrorRuns

remove-item $AllExportErrorRuns

}

 

FIM_ActionThresholds.ps1

#################################################################################################################################

# FIM 2010 Management Agent Runner #

# Author : Lance Hext #

# Mail : lhext@h-cp.us #

# Version : 1.2.3 #

# Information : This Powershell script execcutes an array of managements agents supplied form the calling Powershell #

# script. This powershell script utilizes the FIM wmi interface for the execution and statistics #

# gathering. #

# For each Management executed either a single email is generted per management agent #

# or a combined email is generated which will contain all the statistic from the run. #

# The email containes the following information as part on the email body #

# 1: The Managemenmt agent name #

# 2: The Mnagement Agent complition status #

# 3: All Connector space statistics #

# 4: All Inbound Metaverse statistices #

# 5: All Export data counts #

# The email contains the following attachments #

# 1: The complete run history xml #

# 2: All inbound syncronization errors #

# 3: All Exported syncronization errors #

# #

# #

# #

#################################################################################################################################

# #

# START OF POWERSHELL SCRIPT #

# #

#################################################################################################################################

# #

# * * * * * * * * * * * D O N O T M O D I F Y B E L O W * * * * * * * * * * * * * #

# __________________________________ #

# #

#################################################################################################################################

#################################################################################################################################

# START OF FUNCTIONS #

#################################################################################################################################

$line = "-----------------------------"

function Write-Output-Banner([string]$msg)

{

Write-Output $line,("- "+$msg),$line

}

#################################################################################################################################

# END OF FUNCTIONS #

#################################################################################################################################

# START OF DATA #

#################################################################################################################################

$MAs = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer" -computername $params_ComputerName)

$numOfExecDone = 0

$SendEmails = $true;

#################################################################################################################################

# END OF DATA #

#################################################################################################################################

# START OF PROGRAM #

#################################################################################################################################

Write-Output-Banner($SequenceInfo)

do

{

Write-Output-Banner("Execution #:"+(++$numOfExecDone))

if (!$EmailperMA)

{

$smtp = new-object Net.Mail.SmtpClient($smtpServer)

$smtpmsg = new-object Net.Mail.MailMessage

$smtpmsg.From = $emailFrom

$smtpmsg.To.Add($emailTo)

if ($emailCC)

{

$smtpmsg.Cc.Add($emailCC)

}

if ($emailCC1)

{

$smtpmsg.Cc.Add($emailCC1)

}

$RunStart = Get-Date

$AllRunTimeStart = Get-Date -uformat "%Y%m%d%I%M%S"

$smtpmsg.Subject = "FIM Run Sequence Results Started : " +$RunStart

$smtpbody = "

$smtpbody += "

"

$smtpbody += "

FIM Processing Results"

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email Create Mail Object"

Write-Output ($dbugmsg)

}

$AllRuns = "AllRuns-" + $AllRunTimeStart + ".xml"

$AllImportErrorRuns = "AllRuns-" + $AllRunTimeStart + "-ImportErrors.csv"

$AllExportErrorRuns = "AllRuns-" + $AllRunTimeStart + "-ExportErrors.csv"

}

foreach($MATypeNRun in $params_runProfilesOrder)

{

$found = $false;

$SendEmails = $true;

foreach($MA in $MAS)

{

if(!$found)

{

if($MA.Name.Equals($MATypeNRun.name))

{

$abortnow = $false

$found=$true;

$maname = $MA.Name

Write-Output-Banner("MA Name: "+$MA.Name,"`n- Type: "+$MA.Type)

foreach($profileName in $MATypeNRun.profilesToRun)

{

## Added 01/23/2012 :: Author: Ethan Turk

## Change Info: Added to allow sleeping for individual Sync Cycle

## Steps instead of a sleep which must run for every step.

if($MATypeNRun.sleep -gt 0) {

"Found Sleep. Sleeping for " + $MATypeNRun.sleep + " seconds" | Out-Host

Start-Sleep -Seconds $MATypeNRun.sleep

}

## End Addition

## Added 03/05/2012 :: Author: Ethan Turk

## Change Info: Added to set thresholds for maximum number of changes

## which are allowed in a single run step. You can set individual limits

## for add, updates and deletes.

$abortthreshold = "Threshold Reached on $maname $profileName. Cancelling run cycle..."

if($MATypeNRun.addthreshold) {

$ttype = "Add"

$addstatus = .\FIM_ActionThresholds.ps1 $MA.Name $ttype $MATypeNRun.addthreshold

if($addstatus) {

$abortnow = "$ttype $abortthreshold"

break

}

}

if($MATypeNRun.updthreshold) {

$ttype = "Update"

$updstatus = .\FIM_ActionThresholds.ps1 $MA.Name $ttype $MATypeNRun.updthreshold

if($updstatus) {

$abortnow = "$ttype $abortthreshold"

break

}

}

if($MATypeNRun.delthreshold) {

$ttype = "Delete"

$delstatus = .\FIM_ActionThresholds.ps1 $MA.Name $ttype $MATypeNRun.delthreshold

if($delstatus) {

$abortnow = "$ttype $abortthreshold"

break

}

}

## End Addition

Write-Output ("Run Profile "+$profileName,"`n -> starting")

$RunTimeStart = Get-Date -uformat "%Y%m%d%I%M%S"

$datetimeBefore = Get-Date;

$result = $MA.Execute($profileName);

$datetimeAfter = Get-Date;

$duration = $datetimeAfter - $datetimeBefore;

# Setup SMTP Message

if($EmailperMA)

{

if ($debug)

{

$dbugmsg = "--> DB ---- In Multiple Email Create new Mail Object"

Write-Output ($dbugmsg)

}

$smtp = new-object Net.Mail.SmtpClient($smtpServer)

if ($UseEmailCreds)

{

$smtp.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

}

$smtpmsg = new-object Net.Mail.MailMessage

$smtpmsg.From = $emailFrom

$smtpmsg.To.Add($emailTo)

if ($emailCC)

{

$smtpmsg.Cc.Add($emailCC)

}

$smtpbody = "

$smtpbody += "

"

$smtpbody += "

FIM Processing Results"

#$smtpbody += "

"

$smtpbody += "

Forefront Identity Manager Management Agent Run Results for: " + $MA.Name +"
"

$smtpbody += "

"

$smtpbody += "

"

$smtpmsg.Subject = "FIM Management Agent - " + $MA.Name

if("success".Equals($result.ReturnValue))

{

$msg = "Done. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds

$smtpmsg.Subject += " Processing Success"

$smtpbody += "

"

if ($EmailOnErrorOnly)

{

$SendEmails = $false;

}

}

else

{

$msg = "Done with Error. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds +" - Error: "+$result

$smtpmsg.Subject += " Processing Error"

$smtpbody +="

"

$smtpbody +="

"

}

}

else

{

$smtpbody += "

Forefront Identity Manager Management Agent Run Results
 
 
" + $MA.Name +" Completed Successfully
" + $MA.Name +": Completed.
MA Synchronization Status: " + $result.ReturnValue + "
"

$smtpbody += "

"

$smtpbody += "

"

if("success".Equals($result.ReturnValue))

{

$msg = "Done. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds

$smtpbody += "

"

$smtpbody += "

"

if ($EmailOnErrorOnly)

{

$SendEmails = $false;

}

}

else

{

$msg = "Done with Error. Duration: "+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds +" - Error: "+$result

$smtpbody += "

"

$smtpbody += "

"

}

$SendEmails = $true

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email : New Table "

Write-Output ($dbugmsg)

}

}

# Problems with RunHistory WMI not working with MaGuid or MaName, so I used RunDetails from the MA.

# $RunHistory = get-wmiobject -class "MIIS_RunHistory" -namespace "root\MicrosoftIdentityIntegrationServer" -filter("MaGuid='" + $MA.guid + "'")

# # Write the RunHistory file XML out to a file to then attach to the e-mail, and also set it to a XML attribute.

# $RunHistory[1].RunDetails().ReturnValue | Out-File RunHistory.xml

# Grab the first run-history, which always is the latest result.

# [xml]$RunHistoryXML = $RunHistory[1].RunDetails().ReturnValue

#Take the MA RunDetails RunHistory XML and write to file.

$RunHistFileName = $MA.Name + "-" + $RunTimeStart +"-RunHistory.xml"

$ImportErrorUserFileName = $MA.Name + "-" + $RunTimeStart + "-ImportErrors.csv"

$ExportErrorUserFileName = $MA.Name + "-" + $RunTimeStart + "-ExportErrors.csv"

$MA.RunDetails().ReturnValue | Out-File $RunHistFileName

# Grab the MA run-history and put it into a XML var.

[xml]$RunHistoryXML = $MA.RunDetails().ReturnValue

[xml]$RunHistory1XML = $MA.RunDetails().ReturnValue

# Build User Errors for Exports

$RunHistoryXML."run-history"."run-details"."step-details"."synchronization-errors"."import-error" | select dn,"error-type" | export-csv $ImportErrorUserFileName

$RunHistoryXML."run-history"."run-details"."step-details"."synchronization-errors"."export-error" | select dn,"error-type" | export-csv $ExportErrorUserFileName

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# Discovery Counters #

#################################################################################################################################

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/ma-discovery-counters/filtered-deletions")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/ma-discovery-counters/filtered-objects")

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# Staging Counters #

#################################################################################################################################

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-no-change")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-update")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-delete")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-delete-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/staging-counters/stage-failure")

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# MV Inbound Counters #

#################################################################################################################################

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-remains")

$smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-projected-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-projected-no-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-joined-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-joined-no-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-flow-remove-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-delete-leave-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/flow-failure")

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-no-flow")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-filtered-leave-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-filtered-remove-mv")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/connector-delete-add-processed")

$smtpbody += "

"

# $mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-projected-remove-mv")

# $smtpbody += "

"

# $mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/inbound-flow-counters/disconnector-joined-remove-mv")

# $smtpbody += "

"

$smtpbody += "

"

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-update")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-rename")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-delete")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-delete-add")

$smtpbody += "

"

$mvValue = $RunHistory1XML.SelectSingleNode("run-history/run-details/step-details/export-counters/export-failure")

$smtpbody += "

"

$smtpbody += "

"

#################################################################################################################################

# Outbound Counters #

#################################################################################################################################

$outboundCounters=$RunHistory1XML.SelectNodes("run-history/run-details/step-details/outbound-flow-counters")

foreach($outboundCounter in $outboundCounters)

{

$mvValue = $outboundCounter.ma

if ($debug)

{

Write-Output ($outboundCounter)

Write-Output ($mvValue)

}

$smtpbody += "

"

$mvValue = $outboundCounter.SelectSingleNode("provisioned-add-flow")

$smtpbody += "

"

$mvValue = $outboundCounter.SelectSingleNode("provisioned-disconnect")

$smtpbody += "

"

$mvValue = $outboundCounter.SelectSingleNode("connector-flow")

$smtpbody += "

"

$smtpbody += "

"

}

$smtpbody += "

"

$smtpbody += "

Forefront Identity Manager Management Agent Run Results
 
 
" + $MA.Name +" Completed Successfully
MA Synchronization Status: " + $result.ReturnValue + "
" + $MA.Name +": Completed.
MA Synchronization Status: " + $result.ReturnValue + "
 
 
" + $MA.Name + " Run Statistics
 
MA Run Profile:" + $profileName+"
Start Date & Time:" + $MA.RunStartTime().ReturnValue + "
End Date & Time:" + $MA.RunEndTime().ReturnValue + "
Total Run Time:"+$duration.Hours+":"+$duration.Minutes+":"+$duration.Seconds + "
 
Connector Space Statistics
Total Connector Space Objects:" + $MA.NumCSObjects().ReturnValue +"
Total Connectors:" + $MA.NumTotalConnectors().ReturnValue +"
Connectors:" + $MA.NumConnectors().ReturnValue +"
Explicit Connectors:" + $MA.NumExplicitConnectors().ReturnValue +"
Total Disconnectors:" + $MA.NumTotalDisconnectors().ReturnValue +"
Disconnectors:" + $MA.NumDisconnectors().ReturnValue +"
Explicit Disconnectors:" + $MA.NumExplicitDisconnectors().ReturnValue +"
Total Placeholders:" + $MA.NumPlaceholders().ReturnValue +"
Total Placeholders:" + $MA.NumPlaceholders().ReturnValue +"
 
Discovoery Statistics
Filtered Deletions" + $mvValue.InnerText +"
Filtered Objects:" + $mvValue.InnerText +"
 
Stage Import Statistics
Import Stage Unchanged:" + $mvValue.InnerText +"
Import Stage Add:" + $mvValue.InnerText +"
Import Stage Updates:" + $mvValue.InnerText +"
Import Stage Deletes:" + $mvValue.InnerText +"
Import Stage Delete-Adds:" + $mvValue.InnerText +"
Import Stage Failures:" + $mvValue.InnerText +"
 
Inbound Statistics
Disconnectors
Filtered Disconnectors:" + $MA.NumFilteredDisconnectors().ReturnValue +"
Disconnectors" + $mvValue.InnerText +"
 
Metaverse
Projections - With Flow Updates:" + $mvValue.InnerText +"
Projections - Without Flow Updates:" + $mvValue.InnerText +"
Joins - With Flow Updates:" + $mvValue.InnerText +"
Joins - Without Flow Updates:" + $mvValue.InnerText +"
Deleted Metaverse Objects" + $mvValue.InnerText +"
Disconnected Metaverse Objects" + $mvValue.InnerText +"
Metaverse Flow Failures" + $mvValue.InnerText +"
Connector Objects
Connector With Flow Updates:" + $mvValue.InnerText +"
Connector Without Flow Updates:" + $mvValue.InnerText +"
Connector Filtered" + $mvValue.InnerText +"
Connector Filtered Deleted" + $mvValue.InnerText +"
Connector Delete-Add" + $mvValue.InnerText +"
Metaverse Disconnectors Projected" + $mvValue.InnerText +"
MV Deleted - Joined Disconnectors" + $mvValue.InnerText +"
 
Export Statistics
Export Adds" + $mvValue.InnerText +"
Export Updates" + $mvValue.InnerText +"
Export Renames" + $mvValue.InnerText +"
Export Deletes" + $mvValue.InnerText +"
Export Delete-Adds" + $mvValue.InnerText +"
Export Failures" + $mvValue.InnerText +"
 
OutBound Statistics for: " + $mvValue + "
Provisioning Adds:" + $mvValue.InnerText +"
Provisioning Disconnect:" + $mvValue.InnerText +"
Export Attribute Flow:" + $mvValue.InnerText +"
 
 
"

# Write-Output ( $smtpbody )

if($EmailperMA)

{

if ($debug)

{

$dbugmsg = "--> DB ---- In Multiple Email Send"

Write-Output ($dbugmsg)

}

$RHFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $RunHistFileName)

$smtpmsg.Attachments.Add($RHFile)

$IUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $ImportErrorUserFileName)

$smtpmsg.Attachments.Add($IUFile)

$EUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $ExportErrorUserFileName)

$smtpmsg.Attachments.Add($EUFile)

$smtpmsg.Body = $smtpbody

$smtpmsg.IsBodyHTML = $true

if ($SendEmails)

{

$smtp.Send($smtpmsg)

}

$RHFile.Dispose()

$IUFile.Dispose()

$EUFile.Dispose()

remove-item $RunHistFileName

remove-item $ImportErrorUserFileName

remove-item $ExportErrorUserFileName

}

else

{

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email Conat files"

Write-Output ($dbugmsg)

}

cat $RunHistFileName > $AllRuns

cat $ImportErrorUserFileName > $AllImportErrorRuns

cat $ExportErrorUserFileName > $AllExportErrorRuns

remove-item $RunHistFileName

remove-item $ImportErrorUserFileName

remove-item $ExportErrorUserFileName

}

Write-Output (" -> "+$msg)

Write-Output (" -> "+$result.ReturnValue)

}

}

}

if($abortnow) { break }

}

if(!$found -and !$abortnow)

{

Write-Output ("Not found MA Name:"+$MATypeNRun.name);

}

}

if($abortnow) { $abortnow | Out-Host }

$continue = ($params_numOfExecs -EQ 0) -OR ($numOfExecDone -lt $params_numOfExecs)

if($continue)

{

Write-Output-Banner("Sleeping "+$params_delayBetweenExecs+" seconds")

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email SLEEP Send"

Write-Output ($dbugmsg)

}

if(!$EmailperMA)

{

$smtpbody = "" + $abortnow +

"

" + $smtpbody

$RHFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllRuns)

$smtpmsg.Attachments.Add($RHFile)

$IUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllImportErrorRuns )

$smtpmsg.Attachments.Add($IUFile)

$EUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllExportErrorRuns )

$smtpmsg.Attachments.Add($EUFile)

$smtpmsg.Body = $smtpbody

$smtpmsg.IsBodyHTML = $true

if ($SendEmails -and $abortnow)

{

$smtp.Send($smtpmsg)

}

$RHFile.Dispose()

$IUFile.Dispose()

$EUFile.Dispose()

remove-item $AllRuns

remove-item $AllImportErrorRuns

remove-item $AllExportErrorRuns

}

Start-Sleep -s $params_delayBetweenExecs

}

else

{

Write-Output ("******************************")

}

}

while($continue)

if(!$EmailperMA)

{

$smtpbody = "" +

$abortnow + "

" + $smtpbody

if ($debug)

{

$dbugmsg = "--> DB ---- In Single Email Send"

Write-Output ($dbugmsg)

}

$RHFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllRuns)

$smtpmsg.Attachments.Add($RHFile)

$IUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllImportErrorRuns )

$smtpmsg.Attachments.Add($IUFile)

$EUFile = new-object Net.Mail.Attachment([string](get-location)+'\'+ $AllExportErrorRuns )

$smtpmsg.Attachments.Add($EUFile)

$smtpmsg.Body = $smtpbody

$smtpmsg.IsBodyHTML = $true

if ($SendEmails -and $abortnow)

{

$smtp.Send($smtpmsg)

}

$RHFile.Dispose()

$IUFile.Dispose()

$EUFile.Dispose()

remove-item $AllRuns

remove-item $AllImportErrorRuns

remove-item $AllExportErrorRuns

}

ArrowGreenCoexistence between Exchange forests (without trusts…)  -- Part 10: Configuring Free/Busy
  

Be careful next time you bought a electronic item from Amazon India, Snapdeal , Flipkart or any other site. (IBALL- Best IT World (I) Pvt Ltd FRAUD COMPANY)

$
0
0

Originally posted on: http://geekswithblogs.net/anirugu/archive/2015/11/30/be-careful-next-time-you-bought-a-electronic-item-from.aspx

Months ago I read about some people’s online purchase.  Some people claim that the manufacture have refused to fix the issue after purchase. I hardly remember what is the matter exactly. Now let’s learn from this story.

 

Last year I bought a TV tuner card from amazon India.  Few days ago this device ON and OFF automatically.  One person from my family make a trip to Agra (40 KM) and go to service center. Service center refuse to fix the TTC and tell that amazon is not authorized to sell blah blah blah.

 

When I contact amazon I have been told me to take a paper from them “Warranty not honored”.  Actually the product I bought from Iball . Iball is another thief brand who cheat their customer by making product and put their sticker.

 

I bought Iball glam 3 as my first phone but I got totally cheated by this company. They paid money to news-paper and mention it something like “India’s first phone”. In actual the phone was Made in china (PRC) and they just import it and put their sticker.  This have nothing with India. Only the sticker they put on phone was (maybe, not sure) India.

 

This company are fooling their customer in many way. Not to give link just search with prefix and suffix complaint on google. Many customer  cry and talking how they are cheated. So next time you bought something from Best IT World (I) Pvt Ltd aka iball avoid it.

 

Iball refuse to repair my TTC and Amazon didn’t help me anything. I mention amazon india support is same as tape recorder. They can’t help and support a single thing. Why don’t they changed their name from Amazon support to Amazon Tape Recorder. It’s look fantastic to me.

 

After wasting a lot of time with Iball fraud company and amazon (which still selling iball product) I told amazon that the seller (which sell the TTC to me) is not authorized he tell me to wait. Now In 10 days amazon don’t  even make a single response.

11

 

 

 

 

 

12

 

 

 

 

 

Check that there is Almost 46+ seller who sell this thing.

 13

 

 

 

 

 

 

The company disclaimer that if you don’t buy the product from this seller, we will not repair you. This fraud company can make any policy like.

 

1. If you bought after 1:55 we will not repair your product, You must wait it after 1:59 and before 2:00 PM. Where is the justice. When I bought my product back in 2014 This site doesn’t even have a disclaimer like this. So If I bought my product in 2014 legally how I can bind in this statement.

 

I told amazon about it and they didn’t take any action. They not even reply to my problem. Just reply with “Wait, we will call you back very soon”. Even writing to jeff@amazon.com benefits nothing all you get is same talk like you talk with a corrupt government official.

 

I really don’t care about this but It’s better to write it in internet so people will read this before buying same thing and torcher by manufacture. Same way I am not telling that every Indian company have bad policy. Some bad company of India make a bad impression world wide. Because I can’t do anything I end up by writing this post and lost my 1500 something which I pay for and now device stopped working.

 

A week ago I write a review on snapdeal that snapdeal is not authorized to sell that thing and you will not get warranty from Lenovo. Lenovo have same policy. Not sure about repair but it’s apply to deal and other thing that save some money.

 

They didn’t approve my review. So next time someone bought it from snapdeal Lenovo will refuse some benefits of customer and (because they are not approve review of person like me) they wonder why no-one tell me in comment before I purchase.

 

Actually Any company like Amazon, Snapdeal , flipkart will never approve anything against him. They will even remove you  authentic review if they have any bad impression on user.

 

This kind of  drama thing (Only bought from our authorized dealer) has been started in India and Indian ecommerce site.  Your warranty can be refused just because you bought online or bought from someone who not show on their own site.

 

Be careful. I mention  in my old post that how all these company like Amazon, Snapdeal , Flipkart help nothing but take your time. Next time you wanna bought something then first make a call to the company’s tape recorder department (it’s called Support department actually)  and know more about their policy. Maybe they have policy if you receive the parcel from left hand they will refuse your warranty Nyah-Nyah.

 

 

I write in my previous post that E-commorce is blooming in India. For purchase online customer experience is decreased day by day. Nor amazon , flipkart and snapdeal want to hear your query. They didn’t even care about their seller and buyer. Just want to sell and get the money. So next time you want to buy something be clever, Careful and have patience. Never trust 5 star rating and good comment on site itself. Investigate yourself and found what is hidden behind the scene.

 

I write this post today when I see same thing on HP site. I read it before on lenovo so I feel I must write about it.

 

Happy shopping , Be carefulSmile, Don’t get cheated by anyone.


24 Ways 2015

SQL: Locate stored procs, views, etc. by text

$
0
0

Originally posted on: http://geekswithblogs.net/AskPaula/archive/2015/12/01/169317.aspx


This will locate specific text within an object on a given database. In this case, it will find all views, stored procs which have the text string "Department" somewhere in the body.

use [databaseInstance]
go

SELECT DISTINCT 
   o.name AS Object_Name,
   o.type_desc
FROM sys.sql_modules m        
  INNER JOIN    sys.objects o 
     ON m.object_id = o.object_id 
WHERE m.definition Like '%Department%';

Is This A CPU Bug?

$
0
0

Originally posted on: http://geekswithblogs.net/akraus1/archive/2015/11/12/168683.aspx

I see a lot of different code and issues. One interesting bug was where someone did remove a few lines of code but the regression test suite did consistently report a 100ms slowdown. Luckily the regression test suite was using ETW by default so I could compare the good baseline with the bad one and I could also take a look at the code change. The profiling diff did not make much sense since there was a slowdown but for no apparent reason in the CultureInfo.CurrentCulture.DisplayName property did become ca. 100ms slower.

How can that be? To make things even more mysterious when they changed some other unrelated code the numbers did return back to normal. After looking into it more deeply I found that the basic application logic did not slow down. But instead some unrelated methods did just become much more CPU hungry. The methods were internal CLR methods named COMInterlocked::CompareExchange64 and COMInterlocked::CompareExchange64. The interesting thing is that it happened only under 32 bit and under 64 bit the error did go away. If you are totally confused by now you are in good company. But there is hope. I had a similar problem encountered already over a year ago. I knew therefore that it has something to do with the interlocked intrinsics for 64 bit operands in 32 bit code. The most prominent on 32 bit is

lock cmpxchg8b qword ptr [some register pointing to a memory location] 

which is heavily used by the clr interlocked methods. To reproduce the problem cleanly I have written a little C program where I played a bit around to see what the real issue is. It turns out it is ……

                                                                                Memory Alignment

A picture will tell more than 1000 words:

image

The CPU cache is organized in cache lines which are usually 64 wide. You can find out the cache line size of your CPU with the nice Sysinternals tools coreinfo. On my Haswell home machine it prints something like this

Logical Processor to Cache Map:
**------  Data Cache          0, Level 1,   32 KB, Assoc   8, LineSize  64
**------  Instruction Cache   0, Level 1,   32 KB, Assoc   8, LineSize  64
**------  Unified Cache       0, Level 2,  256 KB, Assoc   8, LineSize  64
********  Unified Cache       1, Level 3,    8 MB, Assoc  16, LineSize  64

The most important number for the following is the LineSize of 64 which tells us how big the smallest memory unit is which is managed by the CPU cache controller. Now back to our slow lockcmpxchg8b instruction. The effect of the lock prefix is that one core gets exclusive access to a memory location. This is usually implemented on the CPU by locking one cache line which is quite fast. But what happens if the variable spans two cache lines? In that case the CPU seems to lock all cache lines which is much more expensive. The effect is that it is at least 10-20 times slower than before. It seems that our .NET application in x86 did allocate a 64 bit variable on a 4 byte (int32) boundary at an address that crossed two cache lines (see picture above). If by bad luck we are using variable 7 for a 64 bit interlocked operation we will cause an expensive global cache lock.

Since under 64 bit the class layout is usually 8 byte aligned we are practically never experiencing variables which are spanning two cache lines which makes all cache line related errors go away and our application was working as expected under 64 bit. The issue is still there but the class layout makes it much harder to get into this situation. But under 32 bit we can frequently find data structures with 4 byte alignment which can cause sudden slowdowns if the memory location we are hitting is sitting on a cache line boundary. Now it is easy to write a repro for the issue:

using System;using System.Diagnostics;using System.Globalization;namespace InterlockedFun
{class Program
    {staticvoid Main(string[] args)
        {int len = 1;if (args.Length == 1)
            {
                len = int.Parse(args[0]);
            }
            var b = newbyte[len];

            var sw = Stopwatch.StartNew();

            var name = CultureInfo.CurrentCulture.DisplayName;

            sw.Stop();
            Console.WriteLine("DisplayName property did take {0:F0}ms", sw.Elapsed.TotalMilliseconds);
        }
    }
}

That is all. You only need to allocate on the managed heap enough data so the other data structures will at some point hit a cache line boundary. To force this you can try different byte counts with a simple for loop on the command line:

for /L %I in (1,1,64) do InterlockedFun.exe %i

At some point the measured times will change quite a lot:

InterlockedFun.exe 29
DisplayName property did take 17ms

InterlockedFun.exe 30
DisplayName property did take 17ms

InterlockedFun.exe 31
DisplayName property did take 17ms

InterlockedFun.exe 32
DisplayName property did take 17ms

InterlockedFun.exe 33
DisplayName property did take 128ms

InterlockedFun.exe 34
DisplayName property did take 93ms

InterlockedFun.exe 35
DisplayName property did take 77ms

You can play with the little sample for yourself to find the worst performing version on your machine. If you now look at WPA with a differential view you will find that CompareExchange64 is responsible for the measured difference:

image

Since that was a such a nice problem here is the actual C Code I did use to verify that the issue only pops up only at cache line boundaries:

#include "stdafx.h"
#include <windows.h>
#include <chrono>constint Iterations = 1000 * 1000;  // yeah heavy locking
size_t  Alignment = 4; // simulate DWORD alignmentint main(int argc, char **argv)
{if (argc == 2)
    {
        Alignment = atoi(argv[1]);
        _tprintf(L"Alignment: %I64d", Alignment);
    }

    auto pAligned = (LONG64 *)_aligned_malloc(10 * sizeof(LONG64), 64);

    auto v1 = (LONG64 *) (((byte *)pAligned) + Alignment)+7; // Now shift our 64 byte cache line aligned variable by 4 bytes and then go 7 // int64 to the right to land on the border of two cache lines

    auto start = std::chrono::high_resolution_clock::now();

    for (int k = 0; k < Iterations; k++)  // simulate many interlocked operations on a variable which crosses two cache lines
    {
        _InterlockedCompareExchange64(v1, 100, 100);
    }
    auto stop = std::chrono::high_resolution_clock::now();
    auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start).count();
    _tprintf(L"\nInterlocked %d iterations did take %I64dms. Average duration interlocked operation: %f us", Iterations,  ms, (ms*1000.0f)/Iterations);

    _aligned_free(pAligned);
    return 0;
}

This will print with bad 4 byte alignment

Interlocked 1000000 iterations did take 1104ms. Average duration interlocked operation: 1.104000 us

but with 8 byte alignment

Interlocked 1000000 iterations did take 26ms. Average duration interlocked operation: 0.026000 us

That is a whooping factor of 42 faster. No wonder that the intel manual recommends to align the variables on page 258 of the 64 ia 32 architectures software developer system programing manual:

… The integrity of a bus lock is not affected by the alignment of the memory field. The LOCK semantics are followed
for as many bus cycles as necessary to update the entire operand. However, it is recommend that locked accesses
be aligned on their natural boundaries for better system performance:
• Any boundary for an 8-bit access (locked or otherwise).
• 16-bit boundary for locked word accesses.
• 32-bit boundary for locked doubleword accesses.
64-bit boundary for locked quadword accesses.  …

The word better should be written in big red letters. Unfortunately it seems that 32 bit code has a much high probability to cause random performance issues in real world applications than 64 bit code due to the memory layout of some data structures. This is not an issue which makes only your application slower. If you execute the C version concurrently

start  cmpxchg.exe && cmpxchg.exe

Then you will get not 1s but 1,5s of runtime because of the processor bus locking. In reality it is not as bad as this test suggests because if the other application uses correctly aligned variables they will operate at normal speed. But if two applications exhibit the same error they will slow each other down.

If you use an allocator which does not care about natural variable alignment rules such as the GC allocator you can run into issues which can be pretty hard to find. 64 bit code can also be plagued by such issues because we have also 128 bit interlocked intrinsics. With the AVX2 SIMD extensions memory alignment is becoming mainstream again. If people tell you that today memory alignment and CPU caches play no role in todays high level programing languages you can prove them wrong with a simple 8 line C# application. To come to an end and to answer the question of the headline: No it is not a CPU bug but an important detail how the CPU performance is affected if you use interlocked intrinsics on variables which span more than one cache line. Performance is an implementation detail. To find out how bad it gets you need to measure for yourself in your scenario.

2015 Harrisburg .Net Code Camp

$
0
0

Originally posted on: http://geekswithblogs.net/raysmithequip/archive/2015/11/14/168722.aspx

With about 100 or so signed up already, it looks like we will be having another great Code Camp!!

If I am lucky I will be able to duck into a couple of sessions!  Over the years I have got know some of the speakers and all I can say is they are ALL good!  

Lance Wulfers has found us yet another code camp sponser, IBM!!  In addition to providing us coffee and donuts, they have some special offers for the attendees...

A Free e-book on IBM Bluemix

http://www.redbooks.ibm.com/abstracts/redp5242.html

6 Month Free Trial of IBM Bluemix

www.surveymonkey.com/r/bluemixPenn

I will be back to thank all the other sponsors, including ITT where the venue is held yearly, TEK Systems, and all the rest.  I wish I could comment on INETA evaporating, but there is not much to say.  We do miss them already.  Although 2015 does not start for another few hours, I am already thinking ahead to Code Camp 2016.  So far this year went pretty darn well, and the groups members have stepped up well while I slacked off a little bit this past couple of months.  ITT Tech has been wonderful and I am looking forward to seeing the results of the renovations.  More to come after the event, be there or be stuck looking at a page prompt.....



Compatibility Problem with Microsoft Test Manager 2010 and Visual Studio 2011

$
0
0

Originally posted on: http://geekswithblogs.net/jakob/archive/2015/11/15/compatibility-problem-with-microsoft-test-manager-2010-and-visual-studio.aspx

UPDATE 10.01.2012:

The issue has been resolved by Microsoft and will be addressed in patch soon. Here is the full description from the Connect site:


“We've identified the rootcause. This bug was introduced in the compatibility GDR patch released for VS 2010 to work against 2011 TFS Server. We shall be releasing a patch soon. Till then, please follow the workaround mentioned to unblock yourselves. “

When setting up a physical environment for a new test controller on our TFS 2010 server, I ran into a problem that seems to be related to having installed the Visual Studio 2010 SP1 TFS Compatibility GDR and/or Visual Studio 2011 Developer Preview

on the same machine as Visual Studio 2010 (SP1)

 

The problem occurs when trying to add a test agent to the physical environment, MTM gives the following error:


Failed to obtain available machines from the selected test controller.


Clicking on the View details link shows the following error dialog:

image


Error dialog: Cannot communicate with the Controller due to version mismatch

 


I have investigated the problem together with Microsoft, and they are working on finding out why this is happening. I have posted the issue on the Connect site here:
https://connect.microsoft.com/VisualStudio/feedback/details/712290/microsoft-test-manager-2010-can-not-communicate-with-test-controllers-when-visual-studio-11-is-installed-on-the-same-machine

 

Workaround

Fortunately, we found a workaround that is not too bad. When facing this problem, go the the Controllers tab that list all the controllers. If you select the controller from the list, it will actually show the test agent.

 

image

Then go back to the Environments tab and voila, the test agent appears now on the list. It seems like the

I’ll post an update when the issue has been resolved by MS

Viewing all 6441 articles
Browse latest View live