Saved for later reference

online repository of stuff I had to google for hours to figure out

Script to add a network printer automatically in Windows

Tags: , , , , ,

I recently had to replace a defective printer with a similar model, but different enough to need a new driver. This meant it would have a new name on the print server, and I had to figure out a way to replace the installed printer on each computer quickly. After some searching, I ended up with the following script:

1
2
3
4
5
6
@echo off
set OLDPRINTER="\\printserver\Xerox Phaser 8560N"
set NEWPRINTER="\\printserver\Xerox Phaser 8560DN PS"
rundll32 printui.dll,PrintUIEntry /q /dn /n%OLDPRINTER%
rundll32 printui.dll,PrintUIEntry /in /n%NEWPRINTER% /q
rundll32 printui.dll,PrintUIEntry /y /n%NEWPRINTER%

The first rundll32 line quietly (/q) deletes (/dn) the printer named (/n) %OLDPRINTER%, while the second line installs (/in) the new printer %NEWPRINTER%, and the final line sets the new printer as default (/y)

Share

Active Directory user GUID

Tags: , , , , , ,

I found this page which contains an old oneliner to get a user GUID in PowerShell – but sadly it doesn’t work anymore.

After some tricking around, I found the following to work:

1
(new-object Guid(,(([directoryservices.directorysearcher] "(samaccountname=theuser)").findall())[0].properties["objectguid"][0])).ToString()
Share

MS Dynamics CRM installation: ASP.NET 2.0 is not installed

Tags: , , , ,

I got this error message on a server while installing Dynamics. At first I thought the problem was that my IIS is running 64 bit .NET 2.0 (I’ve had problems with that in the past), but it turns out that the actual problem is that .NET 4.0 was installed.

This guy figured out what the problem is: The installer checks for a specific filter in the IIS settings, which doesn’t exist when .NET 4.0 has been installed.

I’ll repeat the fix here, hopefully making this a bit more “discoverable” by search engines (searching the exact error message gave me nothing helpful, just tips about runningĀ aspnet_regiis.exe -i repeatedly):

In IIS Manager, right click Web Sites, and select Properties.

Under ISAPI Filters, Add a new filter you call ASP.NET_2.0.50727, pointing to C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll (assuming 64 bit server, otherwise substitute Framework for Framework64).

Dynamics should now install without issue.

Share

© 2009 Saved for later reference. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.