Categories
SQL

SQL 2008 : Move Databae Files to Differnet Path

SQL 2008 : Move Databae Files to Differnet Path

The following commands can be used to move the log/data files for a SQL database Note this is an OFFLUINE process!

/* Find file locations for your database */
SELECT name, dbid FROM sysdatabases WHERE name = ‘lansweeperdb’
SELECT * FROM sys.master_files WHERE database_id  = 16

/* Offline the Database */
ALTER DATABASE lansweeperdb SET OFFLINE;

/* Now move files, use the file names gather in step 1*/
ALTER DATABASE lansweeperdb
MODIFY FILE ( NAME = lansweeperdb, FILENAME = ‘E:\SQLDB\lansweeperdb.mdf’ );


ALTER DATABASE lansweeperdb

MODIFY FILE ( NAME = lansweeperdb_log, FILENAME = ‘E:\SQLDB\lansweeperdb_log.ldf’ );

/* Now online the database */
ALTER DATABASE lansweeperdb SET ONLINE;

 

 

Categories
Windows 7

Windows 7 : Dial-in tab Missing

Windows 7 : Dial-in tab Missing

Copy the following files from a Windows Server 2008 R2 installation to a folder on your computer:

Windows\system32\mprsnap.dll
Windows\system32\rasuser.dll
Windows\system32\rtrfiltr.dll
Windows\system32\en-US\mprsnap.dll.mui
Windows\system32\en-US\rasuser.dll.mui
Windows\system32\en-US\rtrfiltr.dll.mui

Execute the following commands to enable the functionality within dsa.msc:

copy mprsnap.dll C:\Windows\system32\
copy rasuser.dll C:\Windows\system32\
copy rtrfiltr.dll C:\Windows\system32\
copy mprsnap.dll.mui C:\Windows\system32\en-us\
copy rasuser.dll.mui C:\Windows\system32\en-us\
copy rtrfiltr.dll.mui C:\Windows\system32\en-us\
regsvr32.exe C:\Windows\system32\rasuser.dll

Categories
Windows Server 2003

Windows 2003 : Certificate Services – Repair CA Virtual Directories

Windows 2003 : Certificate Services – Repair CA Virtual Directories

Today I had an issue with a subordinate CA, its AIA/CDP/CRL HTTP locations were showing as down. On further investigation I noted that the virtual directories for the CA had in fact vanished out of IIS. The files themselves for the CA were present in the CertEnroll directory, so it was an IIS issue.

To restore the Virtual Directory configuration use the following command: certutil -vroot

Categories
Windows 2008

AD CS : Change the RootCA Validity Period

Change the RootCA Validity Period

certutil -setreg ca\ValidityPeriod “Years”
certutil -setreg ca\ValidityPeriodUnits “10”

When new certificates are generated for the subordinate this will cause the default lifetime for the subordinates to have the same vailidity period as the root CA, therefore change the vailidity period on the subordinate.

Change the subordinateCA Validity Period

certutil -setreg ca\ValidityPeriod “Years”
certutil -setreg ca\ValidityPeriodUnits “1”

Categories
Windows Server 2003

Windows : List Installed Updates

Windows : List Installed Updates

The following vbScript will list all installed updates on a host, the script can also be run against another system  by changing the “.” to “computername“. I used this to help with a recent audit of our systems and found itsaved a lot of time!

Const OpenAsASCII      =  0
Const OverwriteIfExist = -1

Set oShell = CreateObject(“WScript.Shell”)
Set oFSO = CreateObject(“Scripting.FileSystemObject”)

strComputer = “.”

sFile = “C:\” & strComputer & “_updates.txt”
Set fFile = oFSO.CreateTextFile(sFile, OverwriteIfExist, OpenAsASCII)

fFile.WriteLine
fFile.WriteLine “Hotfix report date: ” & Now & vbCrLf

Const HKLM = &H80000002

‘On Error Resume Next
Set objWMIService = GetObject(“winmgmts:” _
     & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

Set colSettings = objWMIService.ExecQuery _
      (“Select * from Win32_OperatingSystem”)

‘ get general info about the OS

‘ Caption value for different OS:
‘ Microsoft Windows 2000 …
‘ Microsoft Windows XP …
‘ Microsoft(R) Windows(R) Server 2003, ….. Edition
For Each objOperatingSystem in colSettings
   strOSCaption = objOperatingSystem.Caption
   Select Case True
     Case InStr(1, strOSCaption, “windows 2000”, vbTextCompare) > 0
       strOS = “Windows 2000”
     Case InStr(1, strOSCaption, “windows xp”, vbTextCompare) > 0
       strOS = “Windows XP”
     Case InStr(1, strOSCaption, “windows(r) server 2003”, vbTextCompare) > 0
       strOS = “Windows Server 2003”
   End Select

   intOSLang = objOperatingSystem.OSLanguage
   strOSLangHex = Right(“000” & Hex(intOSLang), 4)
   strOSServicePack = objOperatingSystem.CSDVersion
Next

Set objReg = GetObject(“WinMgmts:{impersonationLevel=impersonate}!//” _
         & strComputer & “/root/default:StdRegProv”)

strOSLanguage = “Unknown”  ‘ Init value
strKeyPath = “SOFTWARE\Classes\MIME\Database\Rfc1766”
strValueName = strOSLangHex
objReg.GetStringValue HKLM, strKeyPath, strValueName, strOSLanguage

‘ remove unnecessary stuff
arrOSLanguage = Split(strOSLanguage, “;”)
strOSLanguage = arrOSLanguage(UBound(arrOSLanguage))
If Instr(strOSLanguage, “(“) > 0 Then
   arrOSLanguage = Split(strOSLanguage, “(“)
   strOSLanguage = Trim(arrOSLanguage(0))
End If

fFile.WriteLine “OS version: ” & strOSCaption
fFile.WriteLine “SP version: ” & strOSServicePack
fFile.WriteLine “OS language: ” & strOSLanguage

‘ start enumeration of hotfixes

fFile.WriteLine vbCrLf & “Hotfixes Identified:” & vbCrLf

strRegBaseUpdOS = “SOFTWARE\Microsoft\Updates\” & strOS
strRegBaseUpdIE = “SOFTWARE\Microsoft\Updates\Internet Explorer 6\SP1\”

Set colItems = objWMIService.ExecQuery _
     (“Select * from Win32_QuickFixEngineering”,,48)

For Each objItem in colItems
   If objItem.HotFixID “File 1” Then
     fFile.WriteLine “HotFixID: ” & objItem.HotFixID
     fFile.WriteLine “Description: ” & objItem.Description
     fFile.WriteLine “InstalledBy: ” & objItem.InstalledBy
     strInstallDate = Null  ‘ init value

     If InStr(1, objItem.HotFixID, “-IE6SP1-“, vbTextCompare) > 0 Then
       strRegKey = strRegBaseUpdIE & objItem.HotFixID
       objReg.GetStringValue HKLM, strRegKey, _
              “InstalledDate”, strInstallDate
     ElseIf objItem.ServicePackInEffect “” Then
       strRegKey = strRegBaseUpdOS & “\” & objItem.ServicePackInEffect _
             & “\” & objItem.HotFixID
       objReg.GetStringValue HKLM, strRegKey, _
              “InstalledDate”, strInstallDate
     End If

     If IsNull(strInstallDate) Then
       strInstallDate = “(none found)”
     End If
     fFile.WriteLine “InstallDate: ” & strInstallDate
     fFile.WriteLine   ‘ blank line
   End If
Next

fFile.Close
oShell.Run sFile

Categories
Windows Server 2003

Windows 7 : Windows 2003 Print Server

Windows 7 : Windows 2003 Print Server

Came across an issue today where a Windows 7 client would not print to a Windows 2003 x64 print server. The solution was a registry key to disable the use of Async. RPC for printing:

    HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Printers\
    Right-click Printers, point to New, and then click DWORD.
    Type EnabledProtocols.
    Rigkt-click EnabledProtocols.
    In the Value data box, type 6.
    Close Registry Editor.

Reboot the client then test printing again.

More info here: http://support.microsoft.com/kb/2269469

Categories
Windows Server 2003

Userenv : Event 1041

Userenv : Event 1041

On a Windows 2003 server i came across the following errors in the event log:

Windows cannot query DllName registry entry for {CF7639F3-ABA2-41DB-97F2-81E2C5DBFC5D} and it will not be loaded. This is most likely caused by a faulty registration.

Windows cannot query DllName registry entry for {7B849a69-220F-451E-B3FE-2CB811AF94AE} and it will not be loaded. This is most likely caused by a faulty registration.

To resolve this issue simply delete the following registry keys:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{7B849a69-220F-451E-B3FE-2CB811AF94AE}]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions\{7B849a69-220F-451E-B3FE-2CB811AF94AE}]

This issue is caused by the uninstaller not removing all keys created during the installation of IE8.

Categories
Windows 2008

Windows 2008 R2 : Performance Log Data Collectr Import and Export

Windows 2008 R2 : Performance Log Data Collector Import and Export

To export a Data Collector configuration use the command: logman export internal -xml c:\test.xml
To import the configuration, use the command: logman import internal -xml c:\test.xml
 

Categories
Windows Server 2003

Windows Update ; Install Downloaded Updates in Bulk

Windows Update ; Install Downloaded Updates in Bulk

First, copy updates to the server you wish to update then execute the following command to install multiple Windows Update files:

   for /f “tokens=*” %a in (‘dir /b C:\updates\*.msu’) do start /wait wusa.exe %a /quiet /norestart

Categories
Windows Server 2003

Storage Essentials : Beware ‘Get All Details’ Task

Storage Essentials : Beware ‘Get All Details’ Task

Shortly after the introduction of Storage Essentials into an environment, fibre tape backups were interrupted at around 03:00 AM every day. We had various errors reported by hosts:

[Major] From: [email protected] “SYS-LTO5_LIB_Drive_1”  Time: 23/02/2011 03:02:56
[90:51]      Tape8:0:6:0C Cannot write to device (Details unknown.)

[Major] From: [email protected] “CDC-LTO5_LIB_Drive_4”  Time: 23/02/2011 03:03:26
[90:161]     Cannot write filemark. ([5] I/O error)

[Critical] From: [email protected] “/itaedi”  Time: 23/02/2011 03:03:26
    Unexpected close reading NET message => aborting.

[Major] From: [email protected] “UX-ITPROD_OFFLINE”  Time: 23/02/2011 03:04:52
[61:3003]      Lost connection to VBDA named “/itaedi”
    on host server.domain.local.
    Ipc subsystem reports: “IPC Read Error
    System error: [10053] Software caused connection abort

[Minor] From: [email protected] “evamgmt02.domain.local [/CONFIGURATION]”  Time: 22/02/2011 22:44:13
[81:141]      \IISDatabase
    Cannot export configuration object: (Unknown internal error.) => backup incomplete.

It turned out that there was a scheduled task within Storage Essentials ‘Get All Details‘ that ran at 03:00 AM every day. This task scanned all known hosts to check for new fibre attached LUNs/devices.

After disabling this task backups were no longer interrupted. It is still possible tomanually trigger updateson a single host, this does NOT impact backups that are runnin, it only appears that backups are interrupted whilst running the scan on ALL hosts.