Posts Tagged ‘Scripting’

Standardized Logging Interface for PowerShell Scripts and CmdLet’s

February 5th, 2015 2 comments

A few weeks ago, my colleagues had a spotlight on the common .NET logging library NLog ( This specific class library, provides a lot of functions, methods and classes, to perform logging actions in .NET applications, assemblies, etc. in a very professional way. You can decide what you log, where you log (file, database, mail, console, etc…), how much you log, how the log data looks like and when the logs can be recycled, or archived.

Sound’s perfect to me i thought, and for me as an IT professional, it provides me all the features i require for logging, and i don’t need to write my own logging engine.

PowerShell becomes more and more important, even if you have a script, that runs well and you need to find out what’s broken, if you touched the script, a long time ago. Therefor, i thought it would be a cool thing, to have a kind of a “Logging Interface” for my PS-Scripts. Primary, my major goal was, to better understand how .NET-Objects and a scripting engine can interact together.

Important benefits

  1. Common logging functionality for all your PowerShell scripts
  2. Reusable code
  3. Easy to implement for the future

So let’s go ahead and start with the implementation of the LogInterface into your scripts. All you have to do, is, to include the LogInterface.ps1 script into your scripts. In PowerShell it looks like you see it below.

To get the logger work properly and use it, you have to perform the steps Read more…

Easily transfer FSMO Roles vom one DC to a another

December 12th, 2007 2 comments

I’ve wrote a nice batch script how you can transfer FSMO Roles from one domaincontroller to a another. With some simple choices you can move roles between domaincontrollers in a AD environment.

Therefor i use the NTDSUTIL.EXE of the Windows Server Support Tools wich is installed by default on a Windows Domaincontroller.

Before you can use the script: Look if the path to NTDSUTIL.EXE is in the %PATH% variable, to call it globally. Or copy NTDSUTIL.EXE into the script directory. CHOICE.EXE is used to handle the choosable options in the script.

Script call: FSMOtransfer.bat [DNSDOMAIN]

Where [DNSDOMAIN] Must be a Fully Qualified Domain name (FQDN) of a existing Microsoft Active Directory Domain. The script works only if you are logged on as a administrator

Download: FSMORolesTransferScript

Happy Coding!

Fehlersuche/Troubleanalyse mit dem EventLog und seinen Tools

May 25th, 2007 No comments

Folgende Commandline-Tools sind zur Fehleranalyse unter Windows 2000 | XP | 2003 geeignet:

Das mit cscript startende VB-Script: EventQuery.vbs (ist beim Windows Server 2k3 im Resource Kit mit dabei) und Read more…