Remove Service Pack on Windows Server 2008 R2 (Compcln)

by 4. December 2011 01:15

So you need to clean some valuble space on your harddrive.  One directory is probably the C:\Windows\winsxs directory which size is very big.  The SxS stands for Side by Side and keeps all dll’s for each version of each program.  (Or something like that…)

If you found on the net already that you need to use the compcln command on your windows 7 or windows 2008.  You are close – but no sigar.  On windows 2008 R2 the tool can not be found because it is part of Windows 2008 SP2. To clean you WinSxS direcory (or at least remove the service pack from the WinSxS) you can use the DISM command instead of complcln.

DISM stands for Deployment Image Servicing and Management tool.  Normally it is used to manage your WIM image, but you can use it on your current windows installation. 

Take care.  You will not be able to uninstall the service pack after you run this command!  It takes some time, so be patient.  I managed to recover 4,5 GB from my WinSxS folder.

C:\Windows\system32>dism /online /cleanup-image /spsuperseded /hidesp

image

I found this forum post on TechCenter to be pretty usefull in search of information on this problem.

Regain administrator access to your SQL EXPRESS 2008 (R2)

by 28. March 2011 00:32

As I described earlier with a plain SQL server loosing access to your own SQL server or database is a very annoying problem.

The Problem

When starting the Azure Compute Emulator I got this error:

Creating database DevelopmentStorageDb20090919...
Cannot create database 'DevelopmentStorageDb20090919' : CREATE DATABASE permission denied in database 'master'.

One or more initialization actions have failed. Resolve these errors before attempting to run the storage emulator again. These errors can occur if SQL Server was installed by someone other than the current user. Please refer to http://go.microsoft.com/fwlink/?LinkID=205140 for more details.

What this error means is:

  • I was using the useDevelopmentStorage=true parameter, so the emulator connects to the default sqlexpress instance (MACHINE\sqlexpress) on the pc. 
  • Once connected, he tried to create a new database

If SQL Express is not installed by the user your are working with.  The current user is NOT a sysadmin and can’t create any databases).  Adding yourself is neither a solution or enabling the SA user as you are not granted access to do so.

The Solution

Launch the “add self to SQL SysAdmin” script created by ward Beattie.

It saves you days of work and searching.

I highly encourage you to DOWNLOAD the script from the original location.  But just for reference and in case the script got deleted or moved, I added the complete script below.

 


@echo off
rem
rem ****************************************************************************
rem
rem    Copyright (c) Microsoft Corporation. All rights reserved.
rem    This code is licensed under the Microsoft Public License.
rem    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
rem    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
rem    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
rem    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
rem
rem ****************************************************************************
rem
rem CMD script to add a user to the SQL Server sysadmin role
rem
rem Input:  %1 specifies the instance name to be modified. Defaults to SQLEXPRESS.
rem         %2 specifies the principal identity to be added (in the form "<domain>\<user>").
rem            If omitted, the script will request elevation and add the current user (pre-elevation) to the sysadmin role.
rem            If provided explicitly, the script is assumed to be running elevated already.
rem
rem Method: 1) restart the SQL service with the '-m' option, which allows a single connection from a box admin
rem            (the box admin is temporarily added to the sysadmin role with this start option)
rem         2) connect to the SQL instance and add the user to the sysadmin role
rem         3) restart the SQL service for normal connections
rem
rem Output: Messages indicating success/failure.
rem         Note that if elevation is done by this script, a new command process window is created: the output of this
rem         window is not directly accessible to the caller.
rem
rem
setlocal
set sqlresult=N/A
if .%1 == . (set /P sqlinstance=Enter SQL instance name, or default to SQLEXPRESS: ) else (set sqlinstance=%1)
if .%sqlinstance% == . (set sqlinstance=SQLEXPRESS)
if /I %sqlinstance% == MSSQLSERVER (set sqlservice=MSSQLSERVER) else (set sqlservice=MSSQL$%sqlinstance%)
if .%2 == . (set sqllogin="%USERDOMAIN%\%USERNAME%") else (set sqllogin=%2)
rem remove enclosing quotes
for %%i in (%sqllogin%) do set sqllogin=%%~i
@echo Adding '%sqllogin%' to the 'sysadmin' role on SQL Server instance '%sqlinstance%'.
@echo Verify the '%sqlservice%' service exists ...
set srvstate=0
for /F "usebackq tokens=1,3" %%i in (`sc query %sqlservice%`) do if .%%i == .STATE set srvstate=%%j
if .%srvstate% == .0 goto existerror
rem
rem elevate if <domain/user> was defaulted
rem
if NOT .%2 == . goto continue
echo new ActiveXObject("Shell.Application").ShellExecute("cmd.exe", "/D /Q /C pushd \""+WScript.Arguments(0)+"\" & \""+WScript.Arguments(1)+"\" %sqlinstance% \""+WScript.Arguments(2)+"\"", "", "runas"); >"%TEMP%\addsysadmin{7FC2CAE2-2E9E-47a0-ADE5-C43582022EA8}.js"
call "%TEMP%\addsysadmin{7FC2CAE2-2E9E-47a0-ADE5-C43582022EA8}.js" "%cd%" %0 "%sqllogin%"
del "%TEMP%\addsysadmin{7FC2CAE2-2E9E-47a0-ADE5-C43582022EA8}.js"
goto :EOF
:continue
rem
rem determine if the SQL service is running
rem
set srvstarted=0
set srvstate=0
for /F "usebackq tokens=1,3" %%i in (`sc query %sqlservice%`) do if .%%i == .STATE set srvstate=%%j
if .%srvstate% == .0 goto queryerror
rem
rem if required, stop the SQL service
rem
if .%srvstate% == .1 goto startm
set srvstarted=1
@echo Stop the '%sqlservice%' service ...
net stop %sqlservice%
if errorlevel 1 goto stoperror
:startm
rem
rem start the SQL service with the '-m' option (single admin connection) and wait until its STATE is '4' (STARTED)
rem also use trace flags as follows:
rem     3659 - log all errors to errorlog
rem     4010 - enable shared memory only (lpc:)
rem     4022 - do not start autoprocs
rem
@echo Start the '%sqlservice%' service in maintenance mode ...
sc start %sqlservice% -m -T3659 -T4010 -T4022 >nul
if errorlevel 1 goto startmerror
:checkstate1
set srvstate=0
for /F "usebackq tokens=1,3" %%i in (`sc query %sqlservice%`) do if .%%i == .STATE set srvstate=%%j
if .%srvstate% == .0 goto queryerror
if .%srvstate% == .1 goto startmerror
if NOT .%srvstate% == .4 goto checkstate1
rem
rem add the specified user to the sysadmin role
rem access tempdb to avoid a misleading shutdown error
rem
@echo Add '%sqllogin%' to the 'sysadmin' role ...
for /F "usebackq tokens=1,3" %%i in (`sqlcmd -S np:\\.\pipe\SQLLocal\%sqlinstance% -E -Q "create table #foo (bar int); declare @rc int; execute @rc = sp_addsrvrolemember '$(sqllogin)', 'sysadmin'; print 'RETURN_CODE : '+CAST(@rc as char)"`) do if .%%i == .RETURN_CODE set sqlresult=%%j
rem
rem stop the SQL service
rem
@echo Stop the '%sqlservice%' service ...
net stop %sqlservice%
if errorlevel 1 goto stoperror
if .%srvstarted% == .0 goto exit
rem
rem start the SQL service for normal connections
rem
net start %sqlservice%
if errorlevel 1 goto starterror
goto exit
rem
rem handle unexpected errors
rem
:existerror
sc query %sqlservice%
@echo '%sqlservice%' service is invalid
goto exit
:queryerror
@echo 'sc query %sqlservice%' failed
goto exit
:stoperror
@echo 'net stop %sqlservice%' failed
goto exit
:startmerror
@echo 'sc start %sqlservice% -m' failed
goto exit
:starterror
@echo 'net start %sqlservice%' failed
goto exit
:exit
if .%sqlresult% == .0 (@echo '%sqllogin%' was successfully added to the 'sysadmin' role.) else (@echo '%sqllogin%' was NOT added to the 'sysadmin' role: SQL return code is %sqlresult%.)
endlocal
pause

Configuration of MySQL 5.5 on Websitepanel

by 11. March 2011 20:36

So I followed these steps to activate MySQL 5.5 on our websitepanel deployment.

The current version of Websitepanel (1.1.0) doesn’t support Mysql by default.  However, with a few small changes you can get the Mysql version 5.5 to work.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c567fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.3.5.0" newVersion="6.3.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

  • Finally add and update the MySQL configuration in website panel.  These where the values I used
    • Internal Address: 127.0.0.1:3306
    • MySQL Installation Folder: C:\Program Files\MySQL\MySQL Server 5.5
    • Database Browser Logon URL: http://phpmyadmin.ourdomain.com/index.php
    • Root login: root
    • Root password: our root password

There is still a bug with deleting the database.  There are solutions available for this problem, but it’s not urgent for me.  So I didn’t tried it.

Account Lockout and Management Tools

by 13. September 2010 15:54

Today i had some issues with a locked account.

I downloaded the account lockout tools from Microsoft Download Center. 

It includes several tools… 

Additional Account Information

There is a very interesting tool called “additional account info”. It gives more information about a user’s password.

Here you have a screenshot.

image

To see the “Additional Account Info” tab, register the AcctInfo.DLL. on the pc where you are using the MMC “Active Directory Users and Computers” snap-in.  (you might need to install the Administrative tools on your client pc if you don’t want to install the plug-in on your server)

Register the DLL

Use the following command :

regsvr32 %systemroot%\system32\acctinfo.dll

(change the path appropriately)

eventcombMT.exe

This is a pretty cool application.   It goes searching through all event logs of the Domain Servers.

image

Use the Menu Searches – Built-in Searches.  It saves you lot’s of time.  You will see that the servers, event id’s and types are automatically set.  The tool is not blasting fast, but it gathers all information from the selected servers and dumps it into text files.

Make sure you have the right permissions to do search the event logs on those servers.

LockoutStatus.exe

To see the current “bad password count” status on all the domain controllers, launch the tool, choose File – Select Target.  Enter the right username, and you will see on which domain controller the bad password attempts have occurred.

image

Note to self

by 22. June 2008 16:31

Defragment from time to time your disk.

image

(22% free space)

MSSQL error message: "Property Owner is not available for Database [databaseName]"

by 22. June 2008 11:43

Problem

When i clicked on the properties of the Database, I got this error on 2 of my Microsoft SQL Server 2005 databases.

image

TITLE: Microsoft SQL Server Management Studio

Cannot show requested dialog.

ADDITIONAL INFORMATION:

Cannot show requested dialog. (SqlMgmt)

Property Owner is not available for Database '[myDatabaseName]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.PropertyCannotBeRetrievedExceptionText&EvtID=Owner&LinkId=20476

Cause

I have restored this databases in the past from other server's backup, and my original login is apparerently not available on target server.

image

Solution

You can fix it with 'sp_changedbowner sa'.

update:
I removed '2005' the subject of this post because you can have this error message on the Newer SQL Server 2008 also.

update 2:
The syntaxt to use in SQL Server Management Studio is:

use myDBName
EXEC sp_changedbowner 'sa'

Defragmentation

by 20. June 2008 16:28

Everyone knows that I am a "defragmentation-tool user".  Yes, I defragment my drives regularly.  And yes, I am convinced that it helps to keep my PC up and running.  (No, I do not want to reinstall my PC every few months.)

You should definitely check out the new tool from Piriform (the company that created CCleaner and Recuva...), it is called Defraggler!

It doesn't seem the fastest tool on the market, but it has a nice features.

E.g.  You can defragment a file or all files in a Folder.  How cool is that?  I always wondered if deframentation of one file would speed up its loading time.  Or image you have a folder with files that are regularly updated, you might be interested in defragmenting this folder, but leaving the rest of your disk alone.  Of course you can defragment your freespace too.

image

Altough it is a release candidate, it seems a very decent and stable tool.  And the best of all, it is free for personal and corporate use.  (yes, defragmentaion runs on Windows Server 2003) . 

Hooray!

"Show this folder as an e-mail Address Book" check box is disabled in Outlook 2007 Contact folder properties

by 27. May 2008 20:13

2008-05-26 - SOLVED

Problem

I had this problem that my e-mail contacts where not linked to my e-mails.  I found this "Show this folder as an e-mail Address Book", but i was unable to activate the checkbox.

According to the Microsoft Support website you can solve this

When these too solutions are not working you are pretty much left on your own. 

Cause

I've read in my search for a solution that Microsoft Outlook (2007) might loose track of the address book when you move datafiles, when you migrate form a other system or ...

It might be possible that the mail profile gets damaged.

[more] 

Solution

Google and Live served me no solution so i re-read the support articles.
The solution is mentioned if you carefully read the KB 197577 .  It states:

"Your profile is damaged and does not recognize the Outlook Address Book service."

As i was searching for several hours for a solution, I didn't focussed on repairing the profile. I just deleted my mail profile and created a new one. 

These steps solved the issue for me:

  1. take note (and backup's) of all existing outlook settings: attached datafiles, account settings (hostnames, usernames, passwords!), ...
  2. be sure that outlook is not anymore in memory, reboot if necaissary
  3. go to "Mail" in configuration panel (under users for Windows Vista),
  4. remove the profile,
  5. create a profile
  6. start outlook,
  7. re-attach other datafiles datafiles and remove newly created datafiles (for the new profile)
  8. ACTIVATE the "Show this folder as an e-mail Address Book"
  9. Be happy

Hope it helps.

Change Keyboard layout in Windows XP and Windows Server 2003 at logon screen

by 10. May 2008 09:53

While you had to Cannot log on after changing keyboard settings, you can now just configure it.

All you have to do is:

  • Open control panel
  • open the regional and language options
  • go to the advanced tab
  • Activate the "Apply all settings to the current user account and to the default user profile"
    image
  • Press Apply or OK, log off and you will see that the keyboard has the layout you wanted...

The same solution is valid for Windows XP.

Troubleshoot Network Connectivity and Reset TCP/IP Windows XP

by 18. April 2008 18:02

I regularly have some clients with network problems.  Using this article I solved a lot of problems.  The article How to troubleshoot TCP/IP connectivity with Windows XP describes a lot of useful tools to determine where the network problem exists.

If you suspect problems with the Tcp/IP stack.  You can use the article on TechNet: Reset the Internet Protocol (TCP / IP) stack in windows XP.  Because the TCP/IP stack is considered a core component of the Windows XP operating system, you cannot remove it.  You need to follow the instructions given in the article.  Being...

netsh int ip reset c:\resetlog.txt

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen