-
Published on :
20
January
11
-
by :
Benedikt Althaus
-
in :
Operations Manager, Powershell, ... SCOM
-
Comments :
Comments Off
I stumbled about the following warning at a customer:

The warning was thrown for several servers and claimed, that the special eventlog for the feature “branch cache” was not able to be read.
Inspecting the systems didn’t show up that the branch cache feature installed.
Also netsh branchcache show status brought up the message: “This command can only be executed when BranchCache is installed.”
The problem was, that branch cache was installed on the systems brought up a warning, but not needed anymore.
While they where installed and configured, SCOM has discovered the systems.
So I installed the brach cache feature again, set the branch cache to disabled using netsh and uninstalled branch cache feature.
After that I disabled the discovery rules shown in the screenshot below.

Next step was to remove the disabled discoveries from the database using the powershell.
“remove-disabledmonitoringobject”
After that, I removed the disable overrides.
So the warnings didn’t appear again.
-
Published on :
08
December
10
-
by :
Benedikt Althaus
-
in :
Operations Manager, SCOM, ... System Center
-
Comments :
Comments Off
We had several new server with Server 2008 R2 that where identically installed.
On non of this systems we where able to push out the scom agent.
A look at the push log file on the management server (gateways in our case) showed the error message 8000FFFF and something about: registering a firewall rule failed.
Strange, the firewall was disabled on all systems. So, we had a look at the rules on one of the servers and saw a rule called “MOM Agent Installer Service”.
Deleting this rule started to make the push work like a charme.
Digging into the closed monitors on the SCOM, we saw, that the first push failed with the message:
“A system update is in progress”.
So, because of the windows update reboot while the first push was tried, the agent wasn’t installed, but the firewall rule not deleted successfully.
Conclusion:
If push fails with error 80070102 and 8000FFFF in the log, have a look at the firewall on the system, even it is disabled.
-
Published on :
30
September
10
-
by :
Benedikt Althaus
-
in :
Powershell, System Center
-
Comments :
Comments Off
When implementing a new management pack for SCOM 2007 R2, most of the time I try to use Powershell instead of VBScript.
For the development I normally use notepad++, but since this wasn’t installed at customers’ I tried using the ISE.
After an hour of troubleshooting, I switched to the console host of Powershell, and the script was working as suspected.
The code that confused myself are only a few lines:
$api = new-object -comObject 'MOM.ScriptAPI'
$bag = $api.CreatePropertyBag()
$bag.AddValue("test","123")
$api.return($bag)
Running the code in the ISE returns: NOTHING

Running it in the normal console host, retruns the xml structure of the SCOM property bag as suspected.

So, using notepad++ and the consolehost for deployment of managment pack scripts is my recommended way at the moment…
-
Published on :
28
September
10
-
by :
Benedikt Althaus
-
in :
Fun, Powershell
-
Comments :
Comments Off
The powershell has a really nice implementation of a dictionary. It is called Hashtable and can be used to store pairs of keys and values.
Compared with the dictionary used in vbscript, it is really simple to use,
and I have used it several times befor. Till last friday:

There is a method called ‘Add’, really!
And running a get-member agains a hashtable shows at the first entry:
Name MemberType Definition
—- ———- ———-
Add Method System.Void Add(System.Object key, System.Object value)
So where the hell does this error come from.
I decided to make a set-psdebug -step in the powershell ISE.
Have a look what I’ve found:

Yes, you can trust your eyes, there is an acute accent on top of the A
Add -> Ádd
Ok, so where are my glasses:

As you can see, using the ISE with a Font Size of 12
and a sceen resolution of 1920 x 1200
makes it hard to see everything clear.
And I’m really glad, that this wasn’t a real bug to my favorite object hashtable.
-
Published on :
28
September
10
-
by :
Benedikt Althaus
-
in :
Automation, Powershell
-
Comments :
Comments Off
A colleague of mine asked, how to retrieve the IPs from all servers in an active directory quickly.
Here is the answer:
#build a directorysearcher with ldap filter to get only computers
#if only a single server should be determined, change the * in name=* to name=<servername> (without <>)
$ds = new-object system.directoryservices.directorysearcher("(&(objectcategory=computer)(name=*))")
#get the computernames only
$computers = @($ds.findall() | % { ([adsi]$_.path).properties['name'] })
#loop through the names and try collect the IPs using wmi and list them
foreach($c in $computers)
{
Get-WmiObject -computer $c -query "select * from win32_networkadapterconfiguration" | where-object { $_.ipaddress.count -gt 0 } | foreach-object { "$($c): $($_.ipaddress)" }
}
Have fun.
-
Published on :
16
September
10
-
by :
Benedikt Althaus
-
in :
SCOM, System Center
-
Comments :
Comments Off
A customer accidently removed his old SCOM 2007 RMS and installed a completely new 2007 R2 with a new name for the managmentgroup.
After removing the ad integration out of the active directory, the server was still showing up in the SCOM logon console under “Registered Servers”.

So we removed it that way:
1. Open up ADSI in the default naming context.
2. Navigate to the server that is shown but not wanted anymore.
3. Remove the “CN=SDKServiceSCP” under the server object.

-
Published on :
07
September
10
-
by :
Benedikt Althaus
-
in :
Powershell, Server 2008 R2, ... Windows 7
-
Comments :
Comments Off
Since Windows 7 and Server 2008 the build in tool “Problem Step Recorder” can make screenshots automatically on every click that is made. It is perfect for building installation howto’s or any other kind of documentation. Yes, there are more powerfull tools on the market, but hey, its for free…
Only problem is, the files that are delivered as zipped MHT-Files only. So only browsers can show them. You are not able to import them for editing directly into Microsoft Word.
So I decided to build a little parser script in Powershell that converts the mht files from psr.exe into its html-files and jpeg’s.
This script takes the filepath of the zipfile or the unzipped mht file and extracts the hmtl, css, and jpeg’s into a subfolder:
param($file=$(read-host "filename of psr-zip or psr-mht file? "))
function writefile($dir, $fname, $text)
{
$text | out-file -append $dir\$fname -Encoding "default"
}
function convertJPG($dir)
{
$jpgfiles = get-item $dir\*.jpeg.txt
foreach($jpg in $jpgfiles)
{
$filename = $jpg.name.tostring()
"$filename -> $($filename.substring(0,$filename.length-4))"
[System.Convert]::FromBase64String((Get-Content $jpg -readcount 0)) | set-content -Encoding Byte "$dir\$($filename.substring(0,$filename.length-4))"
remove-item $dir\$filename -force
}
}
function extractPSR($zipfile, $destfolder)
{
$shellApplication = new-object -com shell.application
$zip = $shellApplication.Namespace($zipfile)
$dest = $shellApplication.Namespace($destfolder)
$dest.copyhere($zip.Items())
}
if(test-path $file)
{
$file = get-item $file
$folder = (get-date -Format "yyyyMMddHHmmss").tostring()
$folderObject = new-item $folder -type directory -force
$filename = ""
if($file.name.tostring().tolower().endswith(".zip"))
{
$unzipdest = "$($folderobject.fullname.tostring())\temp"
new-item $unzipdest -type directory -force | out-null
extractPSR $file.fullname $unzipdest
$psrfile = get-item "$unzipdest\*.mht"
}
else
{
$psrfiles = $file
}
$content = get-content $psrfile
"Start: creating files in folder $pwd\$folder"
foreach($line in $content)
{
switch -wildcard ($line)
{
"Content-Location: *"
{
#$line
$filename = $line.split(":")[1].trim()
if($filename.tolower().endswith(".jpeg"))
{
"writing: $filename.txt"
}
else
{
"writing: $filename"
}
break;
}
"--=_NextPart_*" { break; }
"Content-Type: *" { break; }
"Content-Transfer-Encoding: base64" { break; }
default
{
if($filename -ne "")
{
if($filename.tolower().endswith(".jpeg"))
{
if($line -ne "")
{
writefile $folder "$filename.txt" $line
}
}
else
{
writefile $folder $filename $line
}
}
break
}
}
}
"Finished: Creating files"
"Start: converting pictures from text to JPG"
convertJPG $folder
"Finished: converting pictures"
$yesno = read-host "Open containing folder? [y] "
if($yesno -eq "" -or $yesno.tolower() -eq "y")
{
&explorer.exe $pwd\$folder
}
}
else
{
"ERROR: $pwd\$file not found"
}
Next thougts are to convert it into a standard documentation directly or crop the slideshow of.
But these are plans for the future,
as well as adding some more comments to the code
Update
As there are several errors with the linefeeds while copying the source code, here you can download it as a .zip-File
psr.zip
-
Published on :
26
July
10
-
by :
Benedikt Althaus
-
in :
SCCM, Server 2008 R2
-
Comments :
Comments Off
Hello,
as written in the post “Change Bitlocker PIN without administrative rights using SCCM” we builed a little gui for non administrative users to change the bitlocker pin.
We where really astounded about the feedback and the questions on how to get the tool or the source code. So we decided to bring it up on Codeplex.
And here it is: http://blpintool.codeplex.com/
Project Description
Deploying Bitlocker with Windows 7 in enterprise environments works pretty nice with the new features which have beend implemented by microsoft. There’s still one big problem to solve. Users can’t change their PBA Bitlocker PIN without administrative priviledges.

Feel free to give away this link and grab the tool on codeplex.
-
Published on :
18
July
10
-
by :
Benedikt Althaus
-
in :
SCCM, System Center
-
Comments :
1 Comment
We had to install the SQL 2005 Reporting Services (included with the SCCM – License of our customer) for enabling the reporting point on the SCCM Site server. The operating system is Server 2008 x64.
But as we started the SQL Server installer, the nothing of the installation features where shown except from the client tools and documentation.
All requirements where checked sucessfully, but installing Reporting Services wasn’t shown.
So we tried a lot of things, enabled 32 bit apps in IIS, restarted several times, added IIS features and so on.
But everything we didn’t show up the selection of Reporting Services feature.
So we started looking at the other software that was installed on that server and found the “Reporting Services 2008 Viewer Redistributable SP1″ installed.
And what to say: that one is the cluprit.
It was installed with the WSUS-Feature.
Removing it shows up the complete feature list in the SQL Server Installer.
But the WSUS started to throw bad messages until we installed the viewer again.
-
Published on :
15
July
10
-
by :
Benedikt Althaus
-
in :
Powershell
-
Comments :
Comments Off
I’m currently working on automation of SCCM software updates using Powershell.
I spend a lot of time on the following extremly simple task.
1. a function creates a list with updates
2. the same function returns the .count of the array of updates
3. the return value is added to an global variable of type Int32
And: Baaaahm -> System.Object[] can not be converted into System.Int32
Where the hell is the System.Object[] coming from? The return was an Int32!
See your self:
function returnTest
{
1..30
$array = 1..30
return $array.count
}
returnTest.gettype()
After I regocognized this behavoir of retrun, I found a very good blog about that:
http://keithhill.spaces.live.com/blog/cns!5A8D2641E0963A97!811.entry
So, make sure to throw away everything expect the return value with [void] or pipe to out-null.
As an alternativ, make sure return is the last command in the function.
So you can grab the value you expected from
$retrunvalue[$returnvalue.length-1] …