New software for file housekeeping

Posted by beakersoft | Posted in we3soft | Posted on 30-06-2011

0


Over at we3soft.com we have recently released some new software, called SpringClean.

It’s a file housekeeping application, with many ways to archive/delete your old files, and advanced features such as searching using a regular expression search, and the ability to update a database with the results of the job

Head over to we3soft.com/springclean now to take a look at it. Its only £5 sterling to register its full functionality.

Handling Deleted Users Who own SQL Reporting Subscription

Posted by beakersoft | Posted in SQL Reporting Services | Posted on 01-06-2011

1


I’ve had an issue this week with some SQL reporting services subscriptions. A user contacted me saying her subscription reports were all failing. At first I assumed there was a problem with the user the report was running as, but it turned out to be something else.

When I tried to change and save the settings on one of the reports, I was presented with this error:

The user or group name ‘Dom\User.Name’ is not recognized. (rsUnknownUserName)

Now, it turned out that the user that had originally create this report subscription had recently been deleted out of the active directory, and there was a lot of reports that this user had created. I had a poke around on the web interface and in the management tools, but i couldn’t see anywhere to change the owner of the subscription.

So, as i’ve had to do in the past I started having a look in the reporting service database. I looked first in the Subscriptions table, and there was an OwnerID field, when I linked this table back to the users table I found it was indeed linked to the old user that had been removed. So, I found a valid user in the table, and ran this SQL to update the Subscriptions table pointing to this user:

UPDATE dbo.Subscriptions SET OwnerID = ‘xxx-xxx-xxx-xxx-New-User’ WHERE OwnerID = ‘xxx-xxx-xxx-xxx-Old-User’

When I opened up the subscription again, the owner was now valid, and I could save the report without the error message. I’m glad i did’nt have to go back to the user and tell them they needed to re-create all the subscriptions!

Incremental Machine Naming In MDT

Posted by beakersoft | Posted in MDT | Posted on 11-03-2010

7


I have recently done some work with the Microsoft Deployment Toolkit, the successor to RIS and kind of extension to WDS. I used RIS quite extensively in the past, and while i did have it working quite well, it was a nightmare to actually setup (half the time it was easer to build 70 machines than to get RIS working!).  WDS and the MDT change all that.

It is now easy to build, and customise all parts of your OS deployment using these technology’s, but as I started using it there was one thing missing from it that old style RIS used to have.  Incremental naming of machines as you build them.

In RIS is was a simple matter of putting a variable into it’s settings, and it worked no problem, now however even though there are hundreds of new options naming in this manor is not one of them. I did a search around and come up with this article at Michael Niehause’s blog.

I have re-written the code from this posting in vb.net, i also had to make a couple of changes to my rules file to get it to work. The only differences between my code and Michael’s is mine is in vb.net and his is c# and mine does not add the machine account with a description to the active directory, I just let the install process do this for me.

The Code

Fire up a new web service project, and add this function to it:

WebMethod(Description:="Returns a new Computer Name to use." & _
" Inputs dns domain, a prefix and OU")> _
Public Function GetNewName(ByVal DnsDomain As String, _
ByVal NamePrefix As String) As String

'build the search, based on the passed domain, then the name prefix
Dim adRoot As New DirectoryEntry("LDAP://" & DnsDomain)
Dim dirSearch As New DirectorySearcher(adRoot, "(name=" & NamePrefix & "*)")
Dim existingNames As New Dictionary(Of String, Guid)()

'loop through the results
For Each result As SearchResult In dirSearch.FindAll()

'get the name, and create a guid holder
Dim strCurrName As String = result.Properties("name")(0).ToString.ToUpper
Dim netbootGuid As New Guid

'if we have a guid use that with this name
If result.Properties("netbootGuid").Count > 0 Then
netbootGuid = New Guid(DirectCast(result.Properties("netbootGuid")(0), Byte()))
End If

'add details to the dictonary, if they are not already there
If Not existingNames.ContainsKey(strCurrName) Then
existingNames.Add(strCurrName, netbootGuid)
End If

Next

'now try and get the next name in sequence
Dim strNextName As String = Nothing

'loop through all the avalabe machine numbers up to max of 999
For i As Int32 = 1 To 999

Dim strNameTest As String = NamePrefix & i.ToString("000")

'is this name in the list, if not we have our name
If Not existingNames.ContainsKey(strNameTest) Then
strNextName = strNameTest
Exit For
End If
Next

'return our new name
Return strNextName

End Function

What its doing

All the code is doing is querying your active directory for machines named like you specify, that end with a unique 3 char number (from 001 to 999). Once it finds one it returns the new name back to you. The good thing about this code is it will re-use any machine you have retired, so no numbers go to waste.

You pass the function the dns name of your active directory and the first part of the computer name (e.g. CA-HR-), and that’s it.

Calling the naming function from MDT

Once you have done your web service and it is callable from your web server, you need to alter your MDT rules file to call it and get a new name. This is all the sections you will have to fill in to get it to work, you will probaly have a lot more in your production system:

[Settings]
Priority=Default,GetNewName
Properties=DnsDomain, NamePrefix

[Default]
SkipComputerName=Yes
DnsDomain=mysite.comp.co.uk
NamePrefix=CA-HR-

[GetNewName]
WebService=http://your-web-server/WDSExtras/WDSNameExtras.asmx/GetNewName
Parameters=DnsDomain, NamePrefix
OSDComputerName=string

All that is happening here is you are telling MDT to run an extra section called GetNewName, and that section is going to call your web service with 2 parameters (created in the default section) and then set OSDComputerName (the key that holds the machine name) to the returning string.

Troubleshooting

Odds are you wont get this right first time, but MDT writes does quite a good job of logging what it has done. On a machine your have deployed if you look in C:\MININT\SMSOSD\OSDLOGS you should be able to find the section that is trying to call the web service, and see what it did, and any errors if they occurred

Folder2Page Plugin

Posted by beakersoft | Posted in Programming | Posted on 11-02-2010

1


Just a quick post to point you in the direction of my latest (ok second ever!) plugin for wordpress. Its called folder2page, you can check out more info at beakersoft.co.uk/folder2page

Its a simple plugin that will allow you to use a directory of images you have on your web space as a simple gallery on page in your blog. There seemed to be a lot of plugins out there for getting images from flickr and other image hosting services, but not much if you wanted to get at the images your self.

Any comments, suggestions etc please let me know!