April 2008 - Posts

If your like me you develop in multiple servers. Using Terminal Services is a easy way to move through these servers remotely and with ease. Often I have 6 or more Remote Sessions open at one time. This as you can well imagine can get very confusing. I got to the point I felt I needed better way to brand my Desktop sessions. I tried wallpaper which by the way works well also. However this trick works as a supplement to the wallpaper trick.This registry edit will add text to the login string on the login after you hit "ctrl alt delete" giving you a chance to identify the machine in case you get confused.

"

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]

"welcome"="Good Times Enter your own welcome message here"

 

"

Most of you would rather the the first title before or.
Can't Remeber where I got most of this script(if you know please send me a hate email) however I did some enhancements and I am reposting it.

DECLARE @DBName varchar(255)

DECLARE @DATABASES_Fetch int

DECLARE DATABASES_CURSOR CURSOR FOR
    select
        DATABASE_NAME   = db_name(s_mf.database_id)
    from
        sys.master_files s_mf
    where
       -- ONLINE
        s_mf.state = 0

       -- Only look at databases to which we have access
    and has_dbaccess(db_name(s_mf.database_id)) = 1

        -- Not master, tempdb or model
    and db_name(s_mf.database_id) not in ('Master','tempdb','model')
    group by s_mf.database_id
    order by 1

OPEN DATABASES_CURSOR

FETCH NEXT FROM DATABASES_CURSOR INTO @DBName

WHILE @@FETCH_STATUS = 0
BEGIN
    declare @DBFileName varchar(256)   
    set @DBFileName = datename(dw, getdate()) + ' - ' +
                       replace(replace(@DBName,':','_'),'\','_')+ '.BAK'

    exec ('BACKUP DATABASE [' + @DBName + '] TO  DISK = N''D:\dbbackup\' +
        @DBFileName + ''' WITH NOFORMAT, INIT,  NAME = N''' +
        @DBName + '-Full Database Backup'', SKIP, NOREWIND, NOUNLOAD,  STATS = 100')

    FETCH NEXT FROM DATABASES_CURSOR INTO @DBName
END

CLOSE DATABASES_CURSOR
DEALLOCATE DATABASES_CURSOR

Make sure the backup path exists on the server.

To restore it, go to

Tools >

Options >

Text Editor >

C# >

General and check "Auto list members" and "Parameter information" checkboxes.

 

More Posts