Archive for the ‘Overflow’ Category

Installing SQL Server 2008R2 or 2008R2 management tools ends in System.Configuration.ConfigurationErrorsException

Friday, February 3rd, 2012

Installing SQL Server 2008R2, 2008R2 Express edition or the 2008R2 Management tools package throws an System.Configuration.ConfigurationErrorsException, and is unable to continue or complete.

Exception details:

System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for userSettings/Microsoft.SqlServer.Configuration.LandingPage.Properties.Settings: Could not load file or assembly ‘System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ or one of its dependencies.

Cause:

This seems to be caused by leftovers from the SQL Server 2008 release on some systems, especialy in combination with VS2010 with Service pack 1

Resolution:

Remove the content of folder C:\Users\\AppData\Local\Microsoft_Corporation

Installing Windows 7 RSAT Tools on Windows 7 SP1

Friday, April 1st, 2011

From: http://social.technet.microsoft.com/Forums/en-US/w7itproSP/thread/0d763f12-30f8-4d13-8534-315d5c34dd0d

Problem: The Windows 7 RSAT package is made for the Windows 7 RTM version and does not install on Windows 7 SP1

Solution: Manualy extract and install the package, bypassing the version check

expand -f:*.* amd*
pkgmgr /n:.Windows6.1-KB958830-x64.xml

While no output is send to the screen, this does install in the background. After a few minutes the RSAT options are added to the add/remove functions section.

Re-enabling user mode exception on 64 bit development machines

Tuesday, March 15th, 2011

With the release of Windows 7 SP1 a hotfix has been included that makes it possible to once again catch user mode exceptions on 64 bit development machines. (see the excelent writup “the case of the disappearing onload exception” here for details and an explanation of what is exactly going on.

To disable the filtering on Windows 7 SP1 development machines add the following registry key:

  • Locate the registry subkey: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
  • Create a registry entry of the DWORD32 type named “DisableUserModeCallbackFilter”
  • Set the value of the DisableUserModeCallbackFilter registry entry to 1

Enabling and disabling the firewall for HYPER-V 2008 and Server 2008 from the command line

Sunday, January 30th, 2011

During installation of especialy server core versions such as HYPER-V 2008 it can be cumbersome to reach the machine with the default secure settings. Below are the commands to disable and re-enable the firewall from the command line

To disable the firewall in the currently running profile, you can issue the command:
netsh advfirewall set currentprofile state off

And re-enable with:
netsh advfirewall set currentprofile state on

One the machine is up and running you can use the RSAT mmc snap in’s to manage in more detail.

Modified video player for C5 CMS system

Sunday, January 9th, 2011

The attached zip file is a modified version of the videoplayer block linked in this thread
It uses Flowplayer to playback the files, fixing the aspect problems with the stock videoplayer block included with concrete. An additional modification is this version, is that autplay is turned OFF, while preloading is left ON.

Download the file, and extract it in the blocks directory of your site. While editing pages, choose the VideoPlayer block.
video player for C5 CMS

How to specify additional default documents for apache

Sunday, January 9th, 2011

from: http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex

The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name. Local-url is the (%-encoded) URL of a document on the server relative to the requested directory; it is usually the name of a file in the directory. Several URLs may be given, in which case the server will return the first one that it finds. If none of the resources exist and the Indexes option is set, the server will generate its own listing of the directory.

Password protecting an apache driven website

Sunday, January 9th, 2011

Create a .htaccess file in the directory you want to protect, it should contain at least the following lines
# Access file
order allow,deny
allow from all
require valid-user
Authname “My Protected Page”
Authtype Basic
AuthUserFile /home/sites/sitename/.htpasswd
Now we want to create the htpasswd file using the htpasswd command in the /usr/sbin/ directory. type:
/usr/sbin/htpasswd -c /home/sites/sitename/.htpasswd username

It will prompt you for the password twice
Next chown the two files to a site-admin username or admin. chmod the files to 755
NOTE: The -c flag in this command signifies that it must create the file. To add further users to the htpasswd file, repeat the same command WITHOUT the -c flag.
To use the server’s /etc/passwd file then the last line of the .htaccess should be:
AuthUserFile /etc/passwd

Please remember that the above example is generic, it will need to be changed to suit your specific needs. Please refer to the extensive documentation available at Apache’s web site for information to assist you in creating the file to suit your needs.

How to change the UUID of a harddrive

Sunday, January 9th, 2011

To set the UUID of a Virtualbox vdi harddrive image, run the following command:

VBoxManage internalcommands setvdiuuid mydisk.vdi

How to convert a VDI file to a VHD file

Sunday, January 9th, 2011

Conversion from and to various virtual formats is build into virtualbox, so to convert a virtualbox harddisk image to a virtual pc (or hyper-v) image, run:

VBoxManage clonehd sourcedisk.vdi targetdisk.vhd –format vhd

If you are working on a copy (as you should), you may need to change the UUID of the harddrive

Backup and restore a MySQL Database from the command line

Sunday, January 9th, 2011

Creating a backup from the command line on the source server

$ mysqldump -h localhost -u username -p database_name > backup_db.sql

Restoring this backup to an existing, empty database on the target server

$ mysql -u username -p database_name < backup_db.sql

WindowsUpdate error 80072F76 when using a proxy on Windows Vista

Sunday, January 9th, 2011

This error is usualy caused if you use a proxy server, and the winhttp module is configured for no proxy, or has an incorrect proxy setting.

Start an elevated command prompt by;
Click the start button
Type Command Prompt
Right click the command prompt icon and choose “Run as Administrator”

To review your proxy settings enter the following command:

netsh winhttp show proxy

To reset (clear) your proxy settings enter the following command:

netsh winhttp reset proxy

To configure (set) a proxy enter the following command:

netsh winhhtp set proxy your.proxy.name:proxyport

(or use the direct proxy ip, eg: netsh winhttp set proxy 172.16.128.5:3128)

Additionaly, if you block sites or attachments based on contents, you may need to whitelist the following sites on your proxy so the downloads may pass unhindered:

windowsupdate.microsoft.com
windowsupdate.com
download.microsoft.com
www.update.microsoft.com

Using a date or time stamp in the name of a batchfile

Sunday, January 9th, 2011

source: http://www.intelliadmin.com/index.php/2007/02/create-a-date-and-time-stamp-in-your-batch-files/

Using the ~ substring operator and the %date% or %time% environment variables, it is possible to insert a date or timestamp into a filename while running a batchfile.

testfile_%date:~-4,4%%date:~-7,2%%date:~-10,2%.zip

wil result in something like testfile_20100112.zip

Slow system shutdown with MS Exchange on a domain controller

Sunday, January 9th, 2011

System shutdown on a windows domain controller with MS Exchange installed can take anywhere around 10-15 minutes. This is caused by the fact that the domain services are shutdown before the MS Exchange services, thus causing them to fail repeatedly.
You have two options to tackle this problem;

1. Shutdown the exchange services before shutting down the operating system. (script below)
net stop MSExchangeES
net stop IMAP4Svc
net stop POP3Svc
net stop RESvc
net stop MSExchangeSRS
net stop MSExchangeMGMT
net stop MSExchangeMTA
net stop MSExchangeIS /Y
net stop MSExchangeSA /Y

2. Set the killservices timeout to a lower value then teh default of 10 minutes. The challenge with this option is to make sure you dont set it so low that it will kill services too soon and cause other problems with exchange or other services.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WaitToKillServiceTimeout default: 600000 (10 minutes)

Re-add the Quick launch bar to Windows 7

Sunday, January 9th, 2011

The new option to lock items to the taskbar is efficient in Windows 7, but if you use a vertical taskbar it becomes a lot less practical to have it clutter your programs list. Here is how to add the “old” quick launch bar back to the Windows 7 task bar.

  • Right click a free area on the Windows task bar and choose “Toolsbars – New Toolbar”
    copy paste the following into the location bar: %appdata%\Microsoft\Internet Explorer\Quick Launch
  • choose “select folder”
  • Drag the bar from it’s default location on the right of the toolbar all the way to the left
  • Right click the new taskbar and disable the optiosn “Show text” and “Show title”
  • Drag the taskbar back to its vertical positioning, and lock it

Net Framework 4 install fails with code 5100 on Windows XP

Sunday, January 9th, 2011

Problem: Installation of either the client portion or the full version of the .NET Framework 4 on Windows XP fails with something like this in the log;

Installing using command ‘C:\DOCUME~1\user\LOCALS~1\Temp\VSDA.tmp\DotNetFX40\dotNetFx40_Full_setup.exe’ and parameters ‘ /q /norestart /ChainingPackage FullX64Bootstrapper /lcid 1033′
Process exited with code 5100
Status of package ‘Microsoft .NET Framework 4 (x86 and x64)’ after install is ‘InstallFailed’

Solution:

.NET 4 requires a reasonable up to date Windows XP installation. You need at least Windows installer 3.1 and Service Pack 3 to be present on the system for the installation to succeed. However, with only those 2 you may still run into problems with WindowsUpdate and other packages, so it would be wise to bring the system up to date through Windows update before performing the install.

How can I verify that my local COM ports are redirected in an RDP session ?

Sunday, January 9th, 2011

A: Start a command window and type the following command at the prompt:
change port /query
The output will look something like this:
AUX = \DosDevices\COM1
COM1 = \Device\RdpDrPort\;COM1:15\tsclient\COM1
COM2 = \Device\RdpDrPort\;COM2:15\tsclient\COM2
COM3 = \Device\RdpDrPort\;COM3:15\tsclient\COM3
LPT1 = \Device\RdpDrPort\;LPT1:15\tsclient\LPT1
PRN = \DosDevices\LPT1

From the above, you can see that COM1-3 and LPT1 are redirected. The number 15 is the session id, so that will change depending on the current session id.

If they are not redirected, the output will look something like this:
AUX = \DosDevices\COM1
COM1 = \Device\Serial0
COM2 = \Device\Serial1

source: http://ts.veranoest.net/ts_faq_client_resources.htm#verify_COM_ports

see also: http://support.microsoft.com/?kbid=314354

Failed to generate a user instance of SQL Server due to failure in retrieving the user’s local application data path

Sunday, January 9th, 2011

When publishing a web application which includes an integrated SQL database you receive the following error:

Failed to generate a user instance of SQL Server due to failure in retrieving the user’s local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

Cause:
The user identity your application is trying to create an instance of the SQL server with, does not have a profile on the computer. You need to change this identity to a valid user.

Resolution:

a) If you are already impersonating a non system account, log in to the local system using that username. This will create the missing profile.

b) If you are currently using a system account for the connection, change it to a valid user account on the machine. To do that: In IIS Manager, change the Apllication Pool identioty to a valid local user with a profile

Correctly configuring NDR and DNSBL on Exchange 2003

Sunday, January 9th, 2011

By default, your Exchange 2003 server will happily accept all mail, only to find during processing that it can not deliver certain mails. It will ony then generate a message back to the sender that the mail cannot be delivered.

While this is fine for legit senders, it becomes problematic with spam. Spam generaly has a non existing or false sender address. In the first case you will end up with endless heaps of undeliverable ndr messages. The second case is worse, a harmless victim is bombarded with potentialy thousedns of spam message he/she didnt send in the first place.

Many documents point to an MS knowledgebase document which disbales NDR messages alltogether. A very bad solution, because now you legit senders that only made a minor typo will never know that their mail never got deliverd.

The solution is to check *before* accepting if the recipient exists. The screenshots below show excatly how to do that. Now email for non existing repcipients will never be accepted in teh first place, and legit senders know there is a problem right away.

Image 1
Open global settings, and bring up the “message delivery” property’s
enable “filter recipients who are nor in the Directory

Image 2
Bring up the property’s for the SMTP Connector
Click Advanced
Click Edit
Enable the “apply recipient filter”

While at it, we can also add DNSBL checks. If you dont have SP2 installed yet on your MS Exchange server do so first. Next, we can add dnsbl support as shown in the image below:
Bring up the Message delivery property’s again
Choose connection filtering
Choose Add
Enter the name and link of the dnsbl service you want to use

NOTE: You need to enable connection filtering on the SMTP service itsself as shown in the second image. Mark the option “Apply Connection Filter” to enable your filters.

By default, your Exchange 2003 server will happily accept all mail, only to find during processing that it can not deliver certain mails. It will ony then generate a message back to the sender that the mail cannot be delivered.

While this is fine for legit senders, it becomes problematic with spam. Spam generaly has a non existing or false sender address. In the first case you will end up with endless heaps of undeliverable ndr messages. The second case is worse, a harmless victim is bombarded with potentialy thousedns of spam message he/she didnt send in the first place.

Many documents point to an MS knowledgebase document which disbales NDR messages alltogether. A very bad solution, because now you legit senders that only made a minor typo will never know that their mail never got deliverd.

The solution is to check *before* accepting if the recipient exists. The screenshots below show excatly how to do that. Now email for non existing repcipients will never be accepted in teh first place, and legit senders know there is a problem right away.

Image 1
Open global settings, and bring up the “message delivery” property’s
enable “filter recipients who are nor in the Directory

Image 2
Bring up the property’s for the SMTP Connector
Click Advanced
Click Edit
Enable the “apply recipient filter”


While at it, we can also add DNSBL checks. If you dont have SP2 installed yet on your MS Exchange server do so first. Next, we can add dnsbl support as shown in the image below:
Bring up the Message delivery property’s again
Choose connection filtering
Choose Add
Enter the name and link of the dnsbl service you want to use

NOTE: You need to enable connection filtering on the SMTP service itsself as shown in the second image. Mark the option “Apply Connection Filter” to enable your filters.

Connecting Windows 7 systems to a Windows NT4 share

Sunday, January 9th, 2011

Connecting Windows 7 systems to a Windows NT4 share

Windows 7 workstations are unable to connect to shares on NT4 systems by default. When using a command like
net view \\servername
you will be presented with an unable to logon message.

Resolution

•start secpol.msc from a command prompt
•Browse to “Local Policies”
•”Security Options”
•”Network Security: LAN Manager authentication level”
•Choose a setting “Send LM & NTLM – use NTLMv2 session security if negotiated”
Go to the network and sharing center, and apply the following settings

•”Work/Home profile
•”Enable network discovery”
•”File and print sharing on”
•”Password protected sharing off”
•”40/56 bit encryption on”
Check the following registry key, or create it if it is missing (home versions)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa

DWORD Name: LmCompatibilityLevel
Value: 1

Reboot

Quick-fix for a more unique filename while using http/ftp uploads with Eurekalog .NET 6.5.9

Sunday, January 9th, 2011

Quick-fix for a more unique filename while using http/ftp uploads with Eurekalog .NET 6.5.9

First of all, you need the Enterprise license from Eurekalog, so you have the source and the license to build your own custom version of the DLL, i will not distribute ANY of the source code or the resulting binaries either public on the form or privately in email, so without the enterprise version you simply cant do this, and you need to upgrade to the enterprise version first :-) It enables you to do exactly this kind of thing, and learn from it in the process.

Locate: Runtime/Dialogs/Main/SendHandlers.cs
Open: SendHandler.cs
Locate line 360, which should define the name of the zipfile

zipFile = ……
Delete it.

Insert the following code in it’s place, or make your own custom brew for the desired filename. This can all be refactored into a single line but i kept it seperate and commented for readability’s sake.

// Get the name of the parent application that is running
string appName = Assembly.GetEntryAssembly().GetName().Name;

// Replace any spaces in the name with - signs, so we get a more or less continues name for the report
appName = appName.Replace(" ", "-");

// Build a new more unique filename for the attachment
string fileName = string.Format("BugReport-{1}-{0}.zip", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"),appName);

// Determine the final zipfile name
zipFile = (Path.GetTempPath() + fileName);

Build, and include your custom binary with the project.

This will give you uploads in the format BugReport-Applicationname-YYYY-MM-DD-HH-MM-SS.zip, giving you a resolution of 1 bug a second for each application that you have sending bugs to teh central location. That still isnt a guarantee files are not overwritten, but if you *realy* want to be sure about that you can use the HTTP upload method and rename the files to something unique on the server end with the script that accepts the file for upload.

Needless to say, i am not affiliated in any way with eurekalog, so if this patch, the application, you application or anything even remotely connected breaks – you get to keep both pieces. It should be obvious to any programmer Eurekalog cant help you with code modification you make yourself.

Disabling Windows XP Print balloon windows

Saturday, August 14th, 2010

Windows XP SP2 has a feature that causes a balloon window to be displayed every time a print job is sent to a printer informing the user that the job has been printed.

To disable this feature, do the following
The following key needs to be created (or edited) with regedit

HKEY_CURRENT_USER\Printers\Settings

Value Name: EnableBalloonNotificationsRemote
Data Type: DWORD
Value: 0

How to enable Windows installer logging

Saturday, August 14th, 2010

Windows installer has a logging service which can give a lot of detail about what is going on “under the hood” when an installation fails. To enable the logging function, create the following registry path and keys:

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer
Reg_SZ: Logging

The value of the field defines the different logging mode’s. You can place multiple letters in the field (or all).

v – Verbose output
o – Out-of-disk-space messages
i – Status messages
c – Initial UI parameters
e – All error messages
w – Non-fatal warnings
a – Start up of actions
r – Action-specific records
m – Out-of-memory or fatal exit information
u – User requests
p – Terminal properties
+ – Append to existing file
! – Flush each line to the log

The generated log files are placed in your system’s TEMP directory. (%TEMP%)

Hyper-V 2008 Powershell Security Warnings

Saturday, August 14th, 2010

After settingthe execution policy for windows powershell to unrestricted, you still are unable to run powershell scripts from a batch file or the command line hout the following warning popping up:

PS C:\MyScripts> Set-ExecutionPolicy unrestricted
PS C:\MyScripts> ./somefile.ps1

Security Warning
Run only scripts that you trust. While scripts from the Internet can be usefull they can also be used to damage your computer.
Do you want to run C:\MyScripts\somefile.ps1?
[D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”):

This is the default warning for scripts that originate from the internet. You can check and change the zone by doing the following:

notepad somefile.ps1:Zone.Identifier

Change the ZoneId to 0 and save the file.

Hyper-V2008 Backup Script

Saturday, August 14th, 2010

Creating the backup scripts

The following code snippets enable you to backup virtual machine vhd files on a hyper-v core installation to a backup directory on the same machine. From there you can pick up the disk files for further archiving.

Before creating and scheduling these files, make sure you enable the running of unsigned scripts, and change the zone of the files to non-internet  as outlined in this document

The controlling batch file is a “normal” batch file and can be scheduled with the AT command or run manualy, and can stop, backup, and start your vhd files one by one.

SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe c:\scripts\vmbackup\StopVM.ps1 “somevm”
xcopy /Y “c:\Users\Public\Documents\Hyper-V\Virtual hard disks\somedisk.vhd” “c:\dbbackup”
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe c:\scripts\vmbackup\StartVM.ps1 “somevm”

Two additional powershell scripts do the actual suspending and restarting of the virtual machines:

StopVM.ps1

# ———- SCRIPT STARTS HERE————–
#
# Script origin and credit: http://www.infotechguyz.com/server2008/manageHyperVvms.html
# Embedding as a backup script: http://www.bunkerhollow.com/blogs/matt/archive/2008/09/24/hyper-v-vm-backup-script-batch-file.aspx
#
# 2010-02-10 Bob Noordam (http://www.nhcoding.nl)
# – Modified to call suspend instead of shutdown to enable backing up of Linux VM’s that dont have integration
# – Modified to stop/start a single vm specified on the command line, to enable backing up vm’s one by one
# and have only one down vm at a time (instead of batch-stop and batch-start)
#

$waitshutdown = 60

$guest = $args[0]
write-host “shutting down $guest”
$vm = gwmi -namespace root\virtualization -query “select * from msvm_computersystem where elementname=’$guest’”
$vmname = $vm.name
$result = $vm.requeststatechange(32769)
if ($result.returnvalue -match “0″) {
start-sleep -s $waitshutdown
write-host “”
write-host “no error while shutting down $guest”
write-host “shutdown of $guest completed” -foregroundcolor green
write-host “”
}
else {
write-host “”
write-host “unable to shutdown $guest result $result” -foregroundcolor red
write-host “”
}
# ———- SCRIPT ENDS HERE————–

And StartVM.ps1

# ———- SCRIPT STARTS HERE————–
#
# Script origin and credit: http://www.infotechguyz.com/server2008/manageHyperVvms.html
# Embedding as a backup script: http://www.bunkerhollow.com/blogs/matt/archive/2008/09/24/hyper-v-vm-backup-script-batch-file.aspx
#
# 2010-02-10 Bob Noordam (http://www.nhcoding.nl)
# – Modified to call suspend instead of shutdown to enable backing up of Linux VM’s that dont have integration
# – Modified to stop/start a single vm specified on the command line, to enable backing up vm’s one by one
# and have only one down vm at a time (instead of batch-stop and batch-start)
#

$waitstart = 60

$guest = $args[0]
write-host “Starting $guest”
$vm = gwmi -namespace root\virtualization -query “select * from msvm_computersystem where elementname=’$guest’”
$result = $vm.requeststatechange(2)
if ($result.returnvalue -match “0″) {
start-sleep -s $waitstart
write-host “”
write-host “$guest is started” -foregroundcolor green
write-host “”
}
else {
write-host “”
write-host “unable to start $guest” -foregroundcolor red
write-host “”
}

# ———- SCRIPT ENDS HERE————–
Scheduling your backup task

One of the remote managable components of the 2008R2 server core is the task scheduler. You can therefore easily schedule the backup task from your workstation.

•Install the remote system administration tools (RSTA)
•Start MMC
•Add the module for the task scheduler, and choose “remote machine”

Creating a share on the HYPER-V server

Finaly create a directory and a share to retrive the backups you created to be able to store them externaly
md c:\dbbackup
net share dbbackup=c:\dbbackup

Installing a web application fails on Vista / Windows 7 / Windows Server 2008

Saturday, August 14th, 2010

Starting the installer results in a near immediate message reading:

“the installer was interrupted before [this application] could be installed. You need to restart the installer to try again.”

Additionaly, the eventlog shows eventid 11708 with a short error message stating “installation failed”

Resolution:

You need to install the IIS6 Metabase compatibility component for the installation to work. The MSI installer requires the IIS6 metabase information to read the available websites and virtual directory’s on the server/workstation.

The component can be added to IIS through the add/remove windows functions of the Software applet in the control panel.