25

How-to : Use SQL Server to query Active Directory

-

I think it’s common problem as Active Directory gets bigger in organizations, control over content of that mission-critical component seems to be lost. Same happened in my place. In addition to that we had to provide information from AD on a regular basis in a form of report. We had no tools to pull all data from AD, process it and present in some readable format. However, I was working with skilled SQL guy who was also very good in Reporting Services. So, I proposed that we can link Active Directory with SQL Server and use Transact-SQL to pull information from AD, process it on SQL and then make it readable and presentable through Reporting Services. That would allow SQL guy to process all information and do all kind of reporting required.

Here are components of our LAB environment before solution went to production:

And below steps how we made SQL Server 2008 R2 to work with Active Directory to use Transact-SQL queries to pull information from directory database.

(more…)

0

Tips & Tricks : Cleanup disk after updating Windows 10 to 1607

-

When you upgraded WIndows 10 to recent Anniversary Update (1607), you might want to reclaim some disk space consumed by old files:

Seems like 35GB or more can be reclaimed.

0

How-to : Relocate iTunes folders to different drive/partition

-

Using any of the iDevices with PC computer with Windows 7 will enfornce us to use iTunes as application which can synchronize content of a device with PC, backup device to the computer, etc. By default iTunes will create all folders for content synchronization between PC and iDevice on C: drive. However, sometimes this might be inconvinient, especially if someone has multiple partitions on hard disk dedicated for certain type of content. Also, when number of applications, music files and movies is growing on iDevice iTunes can consume lot of space, so this might be reasonable to move iTunes content to another partition or disk on our system. I will show quick way how ot make iTunes data move smooth and transparent for our device.

(more…)

0

Tips & Tricks : Remove Event Log Source

-

To remove Event Log Source use this:

Remove-EventLog -Source "Desktop Window Manager"
Replace Desktop Window Manager with Event Log Source you want to remove.
0

First look : System Center Operations Manager 2012 RC installation screenshots

-

As we can download SCOM 2012 RC from Microsoft, I decided to do quick installation in LAB environment. Whole test environment is based on VMware Workstation 8. Deployment of SCOM 2012 will be spread across few servers to separate certain functions (in fact similar to real-life deployments). For SCOM2012 deplyoment I will use following servers:

  • lab-dc-01 – Domain Controller – Windows Server 2008 R2
  • lab-sql-01 – SQL Server – Windows Server 2008 R2 + SQL Server 2008 R2
  • lab-net-01 – SCOM 2012 Management Server – Windows Server 2008 R2 + SCOM 2012 Management Server
  • lab-wks-01 – SCOM 2012 Management Console – Windows 7 x64 Ultimate + SCOM 2012 Management Console

This will be mainly screenshot tour through installation phases of SCOM2012.

Here is schematics of the lab:

(more…)

0

Tips & Tricks : Install Node.js on Debian 7.0 “Wheezy”

-

As on Debian 7.0 Node.js is not included in standard repositories, if you want to install it login to server as a root and issue following commands:

apt-get install curl
curl -sL https://deb.nodesource.com/setup | bash -
apt-get install -y nodejs
4

How-to : Publish multiple URLs with single IP and HAProxy

-

Many times there is a need to publish multiple websites from internal network, but there is only one public IP address available.

How this can be done easy way? HAProxy can help us with it.

In example configuration I have 2 URLs registered to same public IP address:

  • first.laboratory.net
  • second.laboratory.net
  • third.laboratory.net

Here is how HAProxy configuration for given example looks like…

(more…)

0

Simple L2L IPsec VPN on Cisco

-

This is simple Lab environment I built when was working on IPsec VPN tunnel between our internal network environment and 3rd party vendor systems. As we had some issues with establishing IPsec communication, to make sure that everything is fine on my side I start replicating live environment in Lab. To build test environment quick I use GNS3 as platform to run Dynamips hypervisor for IOS. That speeds up whole process of preparation and testing.


(more…)

0

Code snippets : SQL : Backup and FTP Database

-

When browsing repository of all scripts I did use in past, I found one which might be interesting. What this script does is:

  • Backups database to disk (name of database stored in @dbname, patch for backup stored in @archive_path, name of backup fine stored in @fname)
  • Compresses database backup using WinRAR (full command where to find WinRAR and how ot use it stored in @archive_cmd)
  • Generates set of commands for FTP client (series of xp_cmdshell commands redirecting output to F:\Backup\ftpcmds)
  • Uploads compressed backup to FTP server using command prompt FTP client command

I had that as small procedure executed automatically with SQL Server Agent. Script is for Microsoft SQL Server and I was running it on SQL Server 2000 and 2005. Here is code for that small procedure:

 

DECLARE @fname varchar(255)
DECLARE @fname_backup varchar(255)
DECLARE @fname_archive varchar(255)
DECLARE @archive_path varchar(255)
DECLARE @dbname varchar(255)
DECLARE @archive_cmd varchar(255)
DECLARE @put_cmd varchar(255)

SET @dbname = 'dbApplication'
SET @fname = @dbname + '_' + LTRIM(STR(DAY(GETDATE())))  + '.' + LTRIM(STR(MONTH(GETDATE()))) + '.' + LTRIM(STR(YEAR(GETDATE())))
SET @archive_path = 'F:\Backup\'
SET @fname_backup = @archive_path + @fname + '.BAK'
SET @fname_archive = @archive_path + @fname + '.RAR'
SET @archive_cmd = '"C:\Program Files\WinRAR\WinRAR.EXE" a ' + @fname_archive + ' ' + @fname_backup
SET @put_cmd = 'echo put ' + @fname_archive + '>> F:\Backup\ftpcmds'

PRINT @fname_backup
PRINT @fname_archive

BACKUP DATABASE @dbname TO DISK = @fname_backup WITH INIT

EXEC xp_cmdshell @archive_cmd
EXEC xp_cmdshell 'echo open 192.168.10.101> F:\Backup\ftpcmds'
EXEC xp_cmdshell 'echo user dbupload>> F:\Backup\ftpcmds'
EXEC xp_cmdshell 'echo password123>> F:\Backup\ftpcmds'
EXEC xp_cmdshell 'echo cd DB_Backup>> F:\Backup\ftpcmds'
EXEC xp_cmdshell 'echo bin>> F:\Backup\ftpcmds'
EXEC xp_cmdshell 'echo ha>> F:\Backup\ftpcmds'
EXEC xp_cmdshell @put_cmd
EXEC xp_cmdshell 'echo bye>> F:\Backup\ftpcmds'
EXEC xp_cmdshell 'ftp -d -i -n -s:F:\BACKUP\ftpcmds'

I hope that will be handy for someone to automate databsae backups and transfers.

0

How-to : Nagios installation on openSUSE 11.4 “Celadon”

-

Quick installation how-to for Nagios on openSUSE 11.4 “Celadon” platform. Same procedure applies to other versions of opeSUSE platform. I’m using version 11.4 for my LAB purposes.

(more…)