Wednesday, May 1, 2013

Solve ps-drive problem with SCCM2012 sp1 powershell script


I was trying to run a powershell script on a SCCM2012 sp1 machine and couldn't get it to work. After importing the Configuration module I just couldn't access the powershell drive. The problem only occured when trying to use a service account. With my normal admin account everything was working fine. This led me to believe  that it was access permission problems but no, that was a dead end.

Here's what i was trying to do:
Import-Module ‘c:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1’
Cd ps1:
Remove-CMDevice -DeviceName $computername -force

The errors I got was:
Cannot find drive. A drive with the name 'ps1' does not exist.

This command cannot be run from the current drive. To run this command you must first connect to a Configuration Manager drive.

The only problem here was that "get-psdrive" didn't return any ps1: drive that i needed.

Finally I found the error. It seems that starting powershell from within the Configuration Manager Console once registers the ps-drive for the current user account. Here's how you do it

1. In Configuration Manager Console click "Connect via Windows PowerShell"

 2. Type A for "Always run"


All done!

Wednesday, April 17, 2013

Simple way to compare two datarow objects C#

DataRow dr1 = ..

DataRow dr2 = ..

IEqualityComparer<DataRow> comparer = DataRowComparer.Default;

bool isMatch = comparer.Equals(dr1, dr2);
 
Enjoy!

Tuesday, April 2, 2013

MMS 2013 - Las Vegas

MMS 2013 is closing in with only one week to go until show time. We're looking forward to see what news will come from the giant software company, it will be particularly interesting to see third party IT automation and self service solutions.

We'll be back with some posts live from the event!