Monday 9 December 2013

Migrating DNS Zones from one server to another

Follow the steps to migrate dns zones from one windows server to another.

1. Stop the DNS service on source server.

2. Open registry editor using command "regedit" and export the dns zones in .reg from the registry path HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\Cu rrentVersion\DNS Server\Zones 

3. Install DNS service on destination server.

4. Create testing.com DNS zone manually (you can delete it after migration)

5. Copy all .dns files from "c:\windows\System32\dns" and exported .reg file from source server to destination server, .dns files should be copied under "c:\windows\System32\dns" of destination server and double click on the .reg file to import dns zones in the registry of destination server.

6. Restart DNS service on destination server so that you can see all migrated DNS zones in DNS management console.

Please Note: - If you want to replace the IP addresses of your source server to destination server, you do not need to edit the dns records. If you are using new IP addresses for destination server then you can download any tool from google to edit all dns records at one time.

Thursday 7 November 2013

SQL Server 2012 installation error "'ExecuteWorkflowAction' is not valid for the WorkflowIdentity element"

While installing SQL server 2012 we get the error :

"The action type 'ExecuteWorkflowAction' is not valid for the WorkflowIdentity element. The only valid action type is ExecuteWorkflowAction"

This is caused because setup file is unable to execute certain workflow identity stored under the installation files. 
Simple and best workaround to solve this issue is to extract the installation files and run the setup file. You will not get this error again and installation will be completed without problem.

Website Panel error "Login failed for user 'sa'."

Some times while accessing website panel, you get the below error :

Server Error in '/' Application.
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<html>
<head>
<title>Login failed for user 'sa'.</title>
<style>

This error is usually caused by incorrect password.

Inorder to resolve this issue, you need to correct/update the password in web.config file. Follow the steps given below to resolve this issue:

1. Login to your windows server
2. Open IIS and locate the 'Enterprise server'.
3. Explore it and edit the web.config file in "Enterprise server" directory of website panel installation.
4. In web.config you will see the below lines :

<add name="EnterpriseServer" connectionString="server=(local);database=WebsiteP anel;uid=sa;pwd=PASSWORD;" providerName="System.Data.SqlClient" />

5.Check the password, if the password is incorrect and you are not sure of the correct password. Reset the  'sa' password and update the web.config file with correct password.

This will resolve your website panel issue.

Sunday 14 July 2013

How to schedule a PHP script in task scheduler

Quiet often there is a need to execute/run php script on some time interval at server side. And that php scripts should run automatically on windows server. You can add a task in windows task scheduler to run PHP script. 

PHP script can be executed easily on command prompt using the below command:
ex. C:\Path\to\php.exe -f "C:\Path\to\file.php"    
where -f is file attribute - parse and execute file.


Follow the below given steps to configure the PHP script to run in task scheduler.

1. To open task scheduler, click on Start >> Administrative Tools >> Task Scheduler.

2.Click on "create task" from "Actions" menu bar on right pane.




















3. In General tab, enter the name of the task.

4. In triggers tab, click on New and schedule the time at which script should execute, as per your requirements.




5.In Action tab, click on new and select 'Start a program' from Action option.Enter the path of PHP.exe in program/script field. Now enter the file option ex: -f c:\pathToHtdocs\fileName.php in Add Arguments field and click on Ok.



6. In condition tab, it is recommended all the option to default.




7. In settings tab, you can configure the options as per your requirements.


8. You are done with scheduling the PHP script, now you can select 'Run' option from options menu, to execute the task.

Tuesday 14 May 2013

Reset Mysql root Password using my.ini


Follow the below given steps to reset the Mysql root password :

1.Browse to your MySQL installation directory.

2. In there, go to "Data" directory. 

3. Find and Open the file named "my.ini"

4. Please ensure that you take a backup of the file "my.ini" prior making any changes. Between the 1st line "[MySQLD]" and 2nd "PORT=" enter "skip-grant-tables"

5. Restart MySQL Service.

You should now be able to login to MySQL prompt without Password.

Once you are at MySQL Prompt,its time to reset the existing password.

Type in
"UPDATE mysql.user SET Password=PASSWORD('New_password') WHERE User='root';"

This will give something like "Query OK, 0 rows affected (0.04 sec)
Rows matched: 1 Changed: 0 Warnings: 0"

7. Type "FLUSH PRIVILEGES;" and hit enter.

You have just reset your MySQL root password.

Now,Do not Forget to undo the changes made in "my.ini" file.

8. Remove "skip-grant-tables" from "my.ini" and restart MySQL Service.

Now you are ready to use your MySQL Service with New Password.


Remove logs or Entries from the Remote Desktop Connection


I found that most people have no idea how to delete a cached entries from Remote Desktop Connection (RDC) on a Windows OS based computer. In fact, I had no clue how to do this. Even after you log out and select delete profile from the RDC, it will still show up in the Connections drop down next time someone open it. This is a problem because if a user with wrong intent to attack your computer or server open the RDC, it will provide them with half of the solution to hack your system, the IP or domain name!
 I have no idea why a great user friendly software company like Microsoft doesn't explain well on their help sites on registry editing for intermediate to advance users. May be because they don’t want novice users to pick up that information from their site and damage the OS in the process of regedit. Yes, it include the path and how to edit it, but there are no clear cut step by step instructions on how to properly do it.
The following method is the easiest way to delete an entry from Remote Desktop Connection:
-Open regedit: Type regedit on the general search (on the start menu) of the computers running Windows Vista and up. If you have a older OS, then open Run, and type regedit.exe.
-Find this parth: Go in to the Terminal Server Client using, HKEY_CURRENT_USER–>Software–>Microsoft–>Terminal Server Client–>Default
-Delete the entry: You will see all the entries with their respective IP address or domain names recorded on the system history. Pick the one you want to delete and hit delete on your keyboard OR right click and delete it.
Make sure you close the regedit.exe BEFORE you open the RDC because this change may not reflect on the client.
Now you will not see the entry in the RDC client when you open it the next time.

Saturday 27 April 2013

Cannot Set SmarterMail as Default MailServer in Plesk

Some times when you try to integrate latest versions SmarterMail in your plesk. You will get the error :

Error: Set default component failed: defpackagemng failed: Loaded Postoffice Configuration Provider (MEAIPO.DLL)
Unable to assign port to IP address.
Reason:
Unknown IP Address: 169.254.16.152


Kindly follow the below given steps to solve this issue :

1. Go to Regedit.

2. Go to the path : 
     Local_Machhine >> Software >> Wow6432Node >> Plesk >> Psa config >> config 

3.  Locate the record MAIL_PROVIDERW_DLL 
and change it to :
C:\Program Files (x86)\Parallels\Plesk\admin\bin\smartermailprovider.dll

4. Next, locate the path : 

Local_Machhine >> Software >> Wow6432Node >> Plesk >> Psa config >> config >> Packages >> Mailserver and set Default regisrty entry to smartermail

5. Save the registry. No need to reboot.

6. Open Plesk using admin login, go to  Tool and setting >> Server components >> and click on refresh.

Now you will see SmarterMail as default mail server in plesk server components :)
Enjoy!!!

Wednesday 24 April 2013

HOW TO: FIX ERROR - The microsoft.ace.oledb.12.0 provider is not registered on the local machine


Basically, if you're on a 64-bit machine, IIS 7 is not (by default) serving 32-bit apps, which the database engine operates on. So here is exactly what you do:

1) ensure that the 2007 database engine is installed, this can be downloaded at: http://www.microsoft.com/en-us/download/details.aspx?id=23734

2) open IIS7 manager, and open the Application Pools area. On the right sidebar, you will see an option that says "Set application pool defaults". Click it, and a window will pop up with the options.

3) the second field down, which says 'Enable 32-bit applications' is probably set to FALSE by default. Simply click where it says 'false' to change it to 'true'.

4) Restart your app pool (you can do this by hitting RECYCLE instead of STOP then START, which will also work).

5) Done, and your error message will go away.

Thursday 4 April 2013

How to configure IIS 7 to redirect non-www domain to www domain?

One of few legacy leftovers that was never dropped over the years is the common use of www domain prefix. It is not a problem per se for us humans, but SE bots have mind of their own. When traversing a non-www and a www version of a web site, apparently, google and other bots are treating them as two separate web entities, even if content is identical.

This causes confusion in SE databases and in a worst case a drop from the index.
To avoid this confusion, web site operators should redirect their non-www traffic to www version of the website, or redirect the www version to the non-www version of the site.

This should be done using 301 redirect, i.e. when request for http://example.com is made, the web server would return

HTTP/1.1 301 Moved Permanently
Location: http://www.example.com/


response with the location of the new site.


So how can I do this in IIS 7? Well, you have to edit web.config file, modify or add
the following section to its rewrite section.


<rewrite>
   <rules>
      <rule name="non www to www" enabled="true">
         <match url="(.*)" />
         <conditions>
            <add input="{HTTP_HOST}" negate="true" pattern="^www\.([.a-zA-Z0-9]+)$" />
         </conditions>
         <action type="Redirect" url="<a href="http://www.{HTTP_HOST}/{R:0"
>http://www.{HTTP_HOST}/{R:0</a>}" appendQueryString="true" redirectType="Permanent" />
      </rule>
   </rules>
</rewrite>
 
This should be your first rule.

The rewite section should be placed in system.webServer section.

Then just refresh your site and voila you have all trafic to http://example.com/* redirected to http://www.example.com/*

Wednesday 3 April 2013

How to Fix the Error Establishing a Database Connection in WordPress

In this article, we will show you how to fix the error establishing a database connection in WordPress by compiling a list of solutions all in one place.

Note: Before you make any database changes, make sure you have sufficient backups.  

You are getting this error because WordPress is unable to establish a database connection. Now the reason why WordPress is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In my experience, majority of the times this error happens because of some sort of server error however there could be other factors as well. Lets take a look at how to go about troubleshooting this problem. 

First thing you should do is to make sure that you are getting the same error on both the front-end of the site, and the back-end of the site (wp-admin). If the error message is the same on both pages “Error establishing a database connection”, then proceed onto the next step. If you are getting a different error on the wp-admin for instance something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database. 

You can do this by adding the following line in your wp-config.php file:


define('WP_ALLOW_REPAIR', true);

Once you have done that, you can see the settings by visiting this page:

http://www.yoursite.com/wp-admin/maint/repair.php

 
 
Remember, the user does not need to be logged in to access this functionality when this define is set. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt. So once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php.
If this repair did not fix the problem, or you are having trouble running the repair then continue reading this article as you might find another solution to work.

Checking the WP-Config file

 

 wp-config.php is probably the single most important file in your entire WordPress installation. This is where you specify the details for WordPress to connect your database. If you changed your root password, or the database user password, then you will need to change this file as well. First thing you should always check is if everything in your wp-config.php file is the same.

  define('DB_NAME', 'database-name');


define('DB_USER', 'database-username');

define('DB_PASSWORD', 'database-password');

define('DB_HOST', 'localhost');
 Remember your DB_Host value might not always be localhost. Depending on the host, it will be different.

If everything in this file is correct (make sure you check for typos), then it is fair to say that there is something wrong on the server end. 


Check your Web Host (MySQL Server)

 

Often you will notice this Error establishing database connection when your site gets swarmed with a lot of traffic. Basically, your host server just cannot handle the load (specially when you are on shared hosting). Your site will get really slow and for some users even output the error. So the best thing you should do is get on the phone or livechat with your hosting provider and ask them if your MySQL server is responsive. 

For those users who want to test if MySQL server is running yourself, you can do a few things. Test other sites on the same server to see if they are having the issue. If they are also getting the same error, then most definitely there is something wrong with your MySQL server. If you do not have any other site on this same hosting account simply go to your cPanel and try to access phpMyAdmin and connect the database. If you can connect, then we need to verify if your database user has sufficient permission. Create a new file called testconnection.php and paste the following code in it:

 <?php

$link = mysql_connect('localhost', 'root', 'password');

if (!$link) {

die('Could not connect: ' . mysql_error());

}

echo 'Connected successfully';

mysql_close($link);

?>

Make sure to replace the username and password. If the connected successfully, then it means that your user has sufficient permission, and there is something else that is wrong. Go back to your wp-config file to make sure that everything there is correct (re-scan for typos).
If you cannot connect to the database by going to phpMyAdmin, then you know it is something with your server. It does not necessarily means that your MySQL server is down. It could mean that your user does not have sufficient permission. 

In one scenario, MySQL server was running. All other sites on the servers were working fine except for wordpress website. When we tried going to our phpMyAdmin, we ended up getting the error: 

#1045 – Access denied for user ‘foo’@'%’ (using password: YES)

if you get this access denied error in either connecting to your phpMyAdmin or through testconnection.php results, then you should contact your host right away to get them to fix it or just try to delete the mysql database username and recreate it.

How to Fix WordPress Posts Returning 404 Error

WordPress is a powerful CMS. Sometimes a slight tweak can make your website inaccessible. However, finding a solution for any WordPress problem is extremely easy. Common problem that most WordPress users face at some point is WordPress posts returning a 404 Error. In this article we will show you how to fix WordPress posts returning 404 error.

Usually in this scenario a user can access their WordPress admin area, their blog’s main page, but when accessing a single posts they get a 404 Not found error. First of all, don’t panic most of the time your posts are still there and completely safe. This usually happens if your .htaccess file got deleted or something went wrong with the rewrite rules. What you need to do is fix your permalinks settings.

Go to Settings » Permalinks, and simply click on Save Changes button. 


 This will update your permalinks settings and flush rewrite rules. In most cases this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you probably need to update your .htaccess file manually.

Login to your server using FTP, and modify the .htaccess file which is located in the same location where folders like /wp-content/ and /wp-includes/ are located. The easiest thing you can do is to temporarily make the file writeable by changing the permissions to 666. Then repeat the original solution. Don’t forget to change the permissions back to 660. You can also manually add this code in your .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
 

We hope this article helped you resolve posts returning 404 error in WordPress.

How to Grant Remote Access to a MySQL Database

So you’ve just created a user in MySQL, but the user cannot log in, even when using the correct password. What’s the problem?
Generally MySQL users can access the server from the server itself, or from the same network subnet. Remote access to MySQL (through the Internet, or from another private network) must be granted as through a special process.


Granting Remote Access to MySQL:
The database administrator grants permission for the user to access the server from all of the remote locations where the user is authorized.

A detailed discussion of remote access is found in the MySQL 5.1 Reference Manual, however, some simplified steps are here:


1. Log in to MySQL as an administrator. This must be done by command line. Enter the following command from a shell prompt:


mysql -u admin –p

Enter the admin password when prompted.

2. From the MySQL prompt, grant the user access to a specific database schema. The general format of the command to use is:

GRANT ALL PRIVILEGES ON database.* to ‘user’@'yourremotehost' IDENTIFIED BY 'newpassword';

Where:

‘user’ is the user name of an existing MySQL account. The username is enclosed in single quotes, as shown.

database is the name of the database schema where access will be granted. Either the name of the schema can be used, or an asterisk (*) can be used to specify all databases.

‘yourremotehost’ contains either an IP address where the user will access from, or a domain name. The IP address or host name must appear in single quotes, as shown.

‘newpassword’ contains the password the user must use to access the server. The password must appear in single quotes as well.


3. To force the changes to take effect immediately, enter the following command:

FLUSH PRIVILEGES;

Specific Examples:

Example A: Granting access for the user jsmith from an IP address:
GRANT ALL PRIVILEGES ON mydatabase.* to jsmith@'69.234.27.102' IDENTIFIED BY 'jimspassword';

Example B: Granting access from a domain:
GRANT ALL PRIVILEGES ON mydatabase.* to jsmith@'%.mycompany.com' IDENTIFIED BY 'jimspassword';

Example C: Granting access to all schemas:
GRANT ALL PRIVILEGES ON *.* to jsmith@'69.234.27.102' IDENTIFIED BY 'jimspassword';

Example D: Granting access from a specific host name on a domain:
GRANT ALL PRIVILEGES ON *.* to jsmith@'jimspc.mycompany.com' IDENTIFIED BY 'jimspassword';

Monday 1 April 2013

How to add a new Theme to WordPress installation

To add a new Theme to your WordPress installation, follow these basic steps:

1. Download the Theme archive and extract the files it contains. You may need to preserve the directory structure in the archive when extracting these files. Follow the guidelines provided by your Theme author.


2. Using an FTP client to access your host web server, create a directory to save your Theme in the wp-content/themes directory provided by WordPress. For example, a Theme named Test should be in wp-content/themes/test. Your Theme may provide this directory as part of the archive.


3. Upload the Theme files to the new directory on your host server.


4. Follow the instructions below for selecting the new Theme.

Adding New Themes by using cPanel

If your host offers the cPanel control panel, and the Theme files are in a .zip or .gz archive follow these instructions. Note: This assumes the Theme you download is a compressed (zip) file and the files in the zip file are in their 'named' folder.

1. Download the Theme zip file to your local machine.


2. In cPanel File Manager, navigate to your Themes folder. If you have WordPress installed in it's own folder called wordpress, you would navigate to "public_html/wordpress/wp-content/themes" and if WordPress is installed in your web-root folder you would navigate to "public_html/wp-content/themes".


3. Once you've navigated to the Themes folder in cPanel File Manager, click on Upload file(s) and upload that zip file you saved in Step 1.


4. Once the zip file is uploaded, click on the zip file name in cPanel, then in the panel to the right, click on Extract File Contents, and that zip file will be uncompressed.


5. Follow the instructions below for selecting the new Theme.

Adding New Themes using the Administration Panel

You can download Themes directly to your blog by using the Add New Themes option in the Appearance sub-menu.

1. Log in to the WordPress Administration Panel.
2. Select the Appearance panel, then Themes.
3. Select Install Themes
4. Use the sub-menu or the Search or Filter options to locate a Theme you would like to use.
5. Click on the Preview link to preview the Theme or the Install link to upload the Theme to your blog.
6. Use the Upload link in the top sub-menu to upload a zipped copy of a Theme that you have previously downloaded to your machine.

Selecting the Active Theme

To select a Theme for your site:

1. Log in to the WordPress Administration Panel.
2. Select the Appearance panel, then Themes.
3. From the Available Themes section, click on the Theme title (or Theme screenshot) for the Theme you wish to activate.
4. A preview of the Theme will be shown.
5. To activate the Theme click the Activate "Theme Name" link in the top right.

Your selection should immediately become active.

Note: If the Theme preview is blank, do not activate the new Theme without investigating further. Your site may not be displayed correctly, otherwise.

Block IP from accessing website using .htaccess

Block IP from accessing website using .htaccess

To block certain ip address from accessing your website, just create a file with name .htaccess at your root directory with the content below:-

order allow,deny
deny from 192.168.0.1
allow from all

If you want to block multiple ip address using .htaccess simply add one ip address per line as below:-

order allow,deny
deny from 192.168.0.2
deny from 192.168.0.3
deny from 192.168.0.4
allow from all

You can even block a network range ip using .htaccess:-

order allow,deny
deny from 129.0.0
allow from all

Note: .htaccess only works in apache webserver, if you do not know what web server you are on, your can consult with your server administrator for more details.

Sending mail using telnet

The first thing to do is to open a connection from your computer to your mail server.

telnet mail.domain.ext 25

You will then need to declare where you are sending the email from:

HELO local.domain.name

Now give your email address:

MAIL FROM: mail@domain.ext

Now give the recipients address:

RCPT TO: mail@otherdomain.ext

To start composing the message issue the command DATA

If you want a subject for your email type Subjectype subject here- then press enter twice

You may now proceed to type the body of your message (e.g. hello mail@otherdomain.ext from mail@domain.ext)

To tell the mail server that you have completed the message enter a single "." on a line on it's own.

You can close the connection by issuing the QUIT command.

Unable to connect to pipe \\.\pipe\PSA_pipe

1. Identify which database provider is used to store Parallels Plesk Panel by looking up the value of the HKLM\SOFTWARE\Wow6432Node\Plesk\PSA Config\Config\PLESK_DATABASE_PROVIDER_NAME hive in the system registry:

2. Identify the status of the corresponding service:
C:\>sc query PleskSQLServer

SERVICE_NAME: PleskSQLServer
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0


3. Start it up:
sc start PleskSQLServer

ASP.NET Ajax client-side framework failed to load And\Or 'Sys' is undefined

There may be various reason behind this issue. Below are the couple of solutions which is worth trying :

Solution 1: A quick solution is to update your web.config and add following section

<handlers>
    <remove name="WebServiceHandlerFactory-Integrated"/>
    <remove name="ScriptHandlerFactory"/>
    <remove name="ScriptHandlerFactoryAppServices"/>
    <remove name="ScriptResource"/>
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" 
 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
 Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd"  
preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD"  
path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, 
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
 
Solution 2: Add the below code in <httpHandlers>
 
<add verb="GET"
  path="ScriptResource.axd"
  type="Microsoft.Web.Handlers.ScriptResourceHandler"
  validate="false"/>
 
Solution 3 : If you don't have this, add this too under <assemblies>
 
<add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
 PublicKeyToken=31bf3856ad364e35"/>
 
Solution 4 : f that doesn't work too, try deleting files from your "bin" folder
 and rebuild the solution and clear the cache of your browser.
 
Solution 5 : Add this to your web.config
 
<location path="ScriptResource.axd">
   <system.web>
      <authorization>
         <allow users="*"/>
      </authorization>
   </system.web>
</location>
 
Solution 6 : Repair .Net 3.5 SP1 installation from Control Panel - Add/Remove Programs,
as it may be possible an update to 3.5 SP1 can stop web-server delivering Ajax.
 
Final Solution 7 : this could be a caching/compression issue and by putting in the 
following into Web.Config, may resolves the issue. 
 
  <system.web.extensions>
    <scripting>
      <scriptResourceHandler enableCaching="false" enableCompression="false" />
    </scripting>
  </system.web.extensions> 

Sunday 31 March 2013

Windows 2008 Password Complexity

To ensure that accounts being created on your server meets the standard password requirement . This can be enforced on a Win 2008 server by following below steps:

1. Click Start > Run, type gpedit.msc > click OK

2. Computer Configuration > Windows Settings > Security Settings > Account Policies > Password Policy.

Unable to shrink database log file ( DBCC shrinkfile gives error)

Sometimes when trying to shrink the database log file for Ms SQl Database using DBCC SHRINKFILE ('database-name_Log', 1), which is the name for log file. It gives the following error :

"Could not locate file  xxx_Log for database  in sys.database_files. The file either does not exist, or was dropped. "

Solution :

The file name should be the logical file name and not the physical file name. Look in the Database properties, on the Files tab for the Logical Name of the file you are trying to shrink, and use that name.

Alternately, you can run the following query in the respective database from Ms Sql Managment Studio to get the logical name

SELECT df.name FROM sys.database_files AS df WHERE df.type_desc = 'log'

The media family on device is incorrectly formed. SQL Server cannot process this media family Error: 3241

When you try to restore a backup of the database you get the following error:


The media family on device ” is incorrectly formed. SQL Server cannot process this media family.
RESTORE HEADER ONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)

This error occurs due to the following problems:

1. Backup file is corrupted.
2. Backup was taken on a higher version of SQL Server and restoration is being done on the earlier version.

Fix :

1. If you feel backup could be corrupted take the backup again
2. If you are using FTP then use it in binary mode to copy the backup file into local drive
3. If the versions are different then update the SQL Server on the system into which the backup has to be restored
4. Verify the database backup to check what the issue is.

The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

This error you can get while compiling an application in machines like x64 or x86.

There are two solutions to it :
 
1) If you are in development (Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine)
To solve this issue open the project in Visual Studio then:
1. From the solution explorer right-click on project name then click on Properties
2. Click on the Build tab
3. Change Platform target from: Any CPU to x86
4. Re-build your solution
5. You are good to go
 
2) If your application is hosted on IIS(Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine)

This will happen if you have an Ms Office application/DLL incorporated in you application, Very simple steps
1) Open IIS manager
2) Select Application Pools
3) Select the application pool you are using in your website
4) Click on Advanced Settings in the right-pane of the window.  
5) Under General section, set "Enable 32-Bit Applications" to "True".
6) Done.

SQL Warning in Functions.php on line .....The function php_uname()

You get the following error when trying to access your site which uses database :

Warning: The function php_uname(), which your Script uses, was deactivated for safety reasons and cannot not be used.

That isn't an SQL error, it is due to your application is trying to determine the server load and is using a function which your web host must have disabled.

On that line, you should find:

elseif(substr(php_uname()...

Change it to

elseif(substr(@php_uname()..

And you shouldn't receive that message anymore.

Shrinking Truncate SQL SERVER Log File

Following code always shrinks the Truncated Log File to minimum size possible.

USE DatabaseName
GO
DBCC SHRINKFILE(<TransactionLogName>, 1)
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLogName>, 1)
GO 

You are recommended to take full back up right before/after above query.

Roles and Features showing an error HRESULT: 0x800F0818 in Server Manager of windows server 2008 R2

When you open Server Manager both Roles and Features display Error and you are unable to add any role or features. When you select the details link it displays error: HRESULT: 0x800F0818.

You also get the event ID :1601 in event logs.


Rsolution:
1) Browse to c:\Windows\Logs\CBS\


2) Copy the CBS.log to c:\Temp


3) Search the file for errors: corruption or failed


Example:
2012-01-10 19:47:55, Info  CBS  Mark store corruption flag because there is a
mismatch between package identity
package:
Package_for_KB2511455_RTM~31bf3856ad364e35~amd64~~6.1.1.0.
[HRESULT= 0x00000000 - S_OK] 2012-01-10 19:47:55, Info CBS Identity mismatch:
Specified Identity:Package_for_KB2511455_RTM~31bf3856ad364e35~amd64~~6.1.1.0,
actual package Identity:
Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~6.1.7600.16385
[HRESULT = 0x800f0818 - CBS_E_IDENTITY_MISMATCH] 2012-01-10 19:47:55, Info
CBS  Failed to resolve package [HRESULT = 0x800f0818 - CBS_E_IDENTITY_MISMATCH]


4) The above highlighted text indicates that there is an issue with the KB2511455.


5) Download KB2511455 update.


6) Unpack the downloaded KB using the following command:
    Expand -F:* UpdateKBXXXX.msu c:\Temp\KBXXXX_Unpackage


7) After you expand the file you will see UpdateKBXXXX.cab File. Expand it as well using the following command:
    Expand -F:* UpdateKBXXXX.CAB c:\Temp\KBXXXX_Unpackage\CAB


8) Run the following command for taking ownership to the c:\Windows\Servicing\Packages folder.
    takeown /F c:\Windows\Servicing\Packages /D y /R


9) Give a full access to your user account to the c:\Windows\Servicing\Packages folder.


10) Explore c:\Windows\Servicing\Packages folder and rename the following files :
    package_for_kb2511455_rtm~31bf3856ad364e35~amd64~~6.1.1.0.cat
    package_for_kb2511455_rtm~31bf3856ad364e35~amd64~~6.1.1.0.mum


11) Copy the above files from c:\Temp\KBXXXX_Unpackage\CAB
 to c:\Windows\Servicing\Packages folder


12) Server Manager should open as expected now.

Restoring a MSSQL 2005 database stuck in suspect mode

If you happen to notice that your MSSQL database/s are stuck in suspect mode, you can easily run a query that will process the database and restore it for you (restore the status, not the actual database).

To do this, you simply need to run the following query. Keep in mind you will need to change our “your database name” for the actual database name.

EXEC sp_resetstatus yourdatabasename;
ALTER DATABASE yourdatabasename SET EMERGENCY
DBCC checkdb(yourdatabasename)
ALTER DATABASE yourdatabasename SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (yourdatabasename, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourdatabasename SET MULTI_USER


This will correct the issue and you can continue using the database.

PowerShell script cannot be loaded because the execution of scripts is disabled on the system.

If you are unable to run the Powershell script on the Windows server and receive the following error:

File C:\test.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

Resolution:

Change the Windows PowerShell Script Execution Policy with the following command: set-executionpolicy remotesigned

MySQL Password Reset



1. Stop your MySQL server completely.

2. Open your MS-DOS command prompt using “cmd” inside the Run window. Inside it navigate to your MySQL bin folder, such as C:\MySQL\bin using the cd command.

3. Execute the following command in the command prompt: mysqld.exe -u root –skip-grant-tables

4. Leave the current MS-DOS command prompt as it is, and open a new MS-DOS command prompt window.

5. Navigate to your MySQL bin folder, such as C:\MySQL\bin using the cd command.

6. Enter “mysql” and press enter.

7. You should now have the MySQL command prompt working. Type “use mysql;” so that we switch to the “mysql” database.

8. Execute the following command to update the password:

UPDATE user SET Password = PASSWORD(‘NEW_PASSWORD’) WHERE User = ‘root’;

Microsoft JET Database Engine error ''80004005'' - System resource exceeded

The shown error does not mean that the server on which the website is hosted is run out of system resources.

Most of the time this error will show up on Shared Server Environment for any website using "Microsoft Access database".  

===================================
Microsoft JET Database Engine error ''80004005''
System resource exceeded.
===================================

The error shows up while running an extremely large query which Microsoft Access cannot deal with.
To resolve the error, the client needs to compact the database and repair the connection string by adding OLEDB JET driver.

Limit SQL Connections through Windows Advanced Firewall in Server 2008

This article will walk you through creating rules in Windows Advanced Firewall to block remote SQL connections.
By default when enabled Windows Advanced Firewall blocks all incoming traffic unless a rule exists stating otherwise.
Connect to your server via Remote Desktop


* Click Start > Administrative Tools > Windows Firewall with Advanced Security

* Select Windows Firewall with Advanced Security on Local Computer

* Select Windows Firewall Properties

* Ensure Firewall State is On for each tab; Domain Profile, Private Profile, and Public Profile Click OK

* Select Inbound Rules > Select New Rule > Select Port and Click Next

* Enter 1433 under Specific local ports and Click Next

* Select Allow the connection and Click Next

* Click Next

* Enter a Name and Description for the rule and Click Finish

* Right-Click on the newly created Allow Rule and Select Properties

* Click the Scope Tab

* Under Remote IP Address Select These IP addresses and Click Add

* Enter either your IP, IP/subnet or IP Range and click OK

* Click OK

IIS www service fails to start with error ID 1363

You might get the error : Cannot start a new logon session with an ID that is already in use while trying to start the www service.

Follow the below steps to fix the issue :

Ran “regsvr32 qmgr.dll” command.

And reboot server.

The above fix can also be applied if you are getting the  error id 1005 & 7023 while starting World Wide Web Publishing Service.

How to shrink a database log file for MSSQL Using Management Studio?

Shrink a log file for a database:

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.
  2. Expand Databases and then right-click the database that you want to shrink.
  3. Point to Tasks, point to Shrink, and then click Files.
  4. Select the Log file that need to be shrunk.

Using the Transact SQL Query:

To shrink a data or log file using the Transact SQL Query:

  1. Connect to the Database Engine.
  2. From the Standard bar, click New Query.


USE <UserDB>;
GO
DBCC SHRINKFILE (UserDB_Log, 1);

How to retireve the password for an email account in Mail Enable Server?

Check the file AUTH.TAB  in the Mail Enable Config Directory.

E.g. "C:\Program Files\Mail Enable\Config\AUTH.TAB"

You can see the password in text for the email accounts configured in the Mail Enable Server.

How to resolve Windows Login Error: "An unauthorized change was made to Windows"

After connecting to windows server via RDC, you receive error “An unauthorized change was made to Windows


Resolution:

1) Click the option that launches an Internet Browser

2) Type: %windir%\system32 into the address field

3) Find the file cmd.exe

4) Right-click on cmd.exe and select Run as Administrator

5) Type:  cscript %windir%\System32\slmgr.vbs /ilc %windir%\System32\licensing\ppdlic\Security-Licensing-SLC-ppdlic.xrm-ms

6) Hit the Enter key

7) Reboot

Later,Go to your system options and Update your Windows License Key and also run if any Windows Updates are available.