NjoY IT .... KnoW MorE ....

NjoY IT .... KnoW MorE ...

Monday, June 27, 2011

Backup MS SQL 2005 database in Runtime (c#.net)

First Add following object references

Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Smo
Microsoft.SqlServer.SmoEnum
Microsoft.SqlServer.SqlEnum
SqlServerBackupRestore

Then add the following to your program 


using Microsoft.SqlServer.Management;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;

Then copy this function definition and paste in your program


public void BackupDatabase(String databaseName, String userName, String password, String serverName, String destinationPath)
        {
            Backup sqlBackup = new Backup();
           
            sqlBackup.Action = BackupActionType.Database;
            sqlBackup.BackupSetDescription = "ArchiveDataBase:" + DateTime.Now.ToShortDateString();
            sqlBackup.BackupSetName = "Archive";

            sqlBackup.Database = databaseName;

            BackupDeviceItem deviceItem = new BackupDeviceItem(destinationPath, DeviceType.File);
            ServerConnection connection = new ServerConnection(serverName, userName, password);
            Server sqlServer = new Server(connection);
           
            Database db = sqlServer.Databases[databaseName];
           
            sqlBackup.Initialize = true;
            sqlBackup.Checksum = true;
            sqlBackup.ContinueAfterError = true;
           
            sqlBackup.Devices.Add(deviceItem);
            sqlBackup.Incremental = false;

            sqlBackup.ExpirationDate = DateTime.Now.AddDays(3);
            sqlBackup.LogTruncation = BackupTruncateLogType.Truncate;

            sqlBackup.FormatMedia = false;

            sqlBackup.SqlBackup(sqlServer);
        }


call this method in which event you want to backup database


This should work because am using it ....enjoy .. hav fun

Wednesday, March 2, 2011


 Hacking admin or administrator account using net user command
Note: This will work only when user has access of user account or some how he has been allowed  or working in admin account.
Steps to hack admin account:
Step1: Goto the Start and click on Run and Type cmd and press enter ... 
Step 2: Now type "net user" in the command prompt to obtain the All accounts on that computer.. as shown in figure..


Step 3: Now Select the account Which u want to Reset the Password...
Suppose that we want to Reset the Password  of Administrator...
Now Type "net user Administrator *  " Without quotes... and press Enter



Step 4: Now after that press Enter Twice the new password. Now Next time u open that Account .. password ll be changed

Hav fun ...Pls use This only for educational purpose