DbUp setting command timeout in PowerShell (ExecutionTimeout)

I needed to increase the command timeout in DbUp from the default 30s to 10min and all examples that I found were in C#.

The good news is that PowerShell support of .net is really good and I manage to even use a callback function:


$dbUp = [DbUp.DeployChanges]::To
$dbUp = [SqlServerExtensions]::SqlDatabase($dbUp, $constr)
$dbUp = [StandardExtensions]::WithScriptsFromFileSystem($dbUp, $scriptPath)

$dbUp.Configure({ param($c); $c.ScriptExecutor.ExecutionTimeoutSeconds = 10 * 60 }) # 10 min command timeout

$dbUp = [StandardExtensions]::LogToConsole($dbUp)
$upgradeResult = $dbUp.Build().PerformUpgrade()

If you want to use DbUp for database maintenance script automation check here.

Reference article with C# timeout setting solution here.

DbUp setting command timeout in PowerShell (ExecutionTimeout)

How to enable IIS Configuration Auditing with Command Line (tool)?

Eventvwr_iconIIS configuration auditing is a feature that would let you monitor the changes that are done to the IIS configuration store. It generates event messages (similar to those generated by enabling metabase auditing in the previous versions). It would display the configuration element which was changed, the user who initiated the change, and the original and the new value of the element.

If you do it on a single server ones – the UI will be the easiest choice:

  1. Open Event Viewer (Administrative Tools –> Event Viewer)
  2. Expand the “Application and Service Logs”
  3. Expand “Microsoft”, and expand “Windows”
  4. Expand “IIS-Configuration”, and right click on “Operational”, and choose “Enable Log”
    EventLog-EnableIISConfig

For DevOps – the command line is:

wevtutil sl Microsoft-IIS-Configuration/Operational /e:true

Wevtutil.exe is a Microsoft tool for modifying the EventLog.

Have in mind that manual changes (with notepad for example) in the config files will not be detected and logged.

Cheers,

Nik Todorov

How to enable IIS Configuration Auditing with Command Line (tool)?

bootstrap, knockout.js, radio buttons group, can play nice and can be dynamic

I’ve tried to use knockout.js (KO) with bootstrap and I found that it will not work out of the box. The main reason – bootstrap will prevent the click events to go to knockoutjs.

I had two challenges:
1. How to notify KO about the click event without breaking bootstrap?
2. How to do KO data binding with the radio buttons?

After some investigation/googling the answer for challenge 1 became apparent – use custom bindings in knockoutjs: http://knockoutjs.com/documentation/custom-bindings.html

That solved the click event on the buttons.

The answer for number 2: How to use knockoutjs to create dynamically the items (buttons) in my bootstrap radio button group? – It was harder for me – All examples were with static/predefined radio buttons.

The solution came again from the KO documentation – I just did a careful modification of their example for the checkbox to a radio button.
I have the working example below in a gist extracted from my jsfiddle

The key code:

<div class="btn-group" data-toggle="buttons" data-bind="foreach: items">
    <label class="btn btn-primary">
    <input type="radio" name="options" data-bind="checkedValue: $data.id, bsChecked: $root.chosenItem" />
    <span data-bind="text: itemName"></span>
    </label>
</div>​

..and the full gist:

 

If you have any questions, feel free to use the comments section bellow.

Happy coding and let’s code the planet togeter! 🙂

bootstrap, knockout.js, radio buttons group, can play nice and can be dynamic

How to list the members of local Administrators group with windows command line

Some time savers for you:

If you need to list all members in ANY local windows group this is the command line:

net localgroup Administrators

If you need to list a domain group

net group MyGroupName /domain

if you need to see information for a domain user (includes is active and his groups):

net user MyUserName /domain

Cheers,

Nik

How to list the members of local Administrators group with windows command line

Visual Studio 2015, Mac OS and F12 (F11) not working

I’ve recently downloaded the new VisualStudio 2015 community edition on my MacBookPro and started enjoying all new features. I’m using Parallels virtual software to host my Windows 10.

Both Win 10 and VS2015 are a really nice piece of software to use, but I found one very annoying problem – F12 did not work. I assume that you are a software developer – you know how often we are using F12, and I needed to right-click -> find declaration a lot.

I knew that this is not VisualStudio problem and that most probably is some setting in my MacOS, so I’ve started digging.

First in MacOS:

under Settings > Keyboard > Keyboard > 
check "Use all F1,F2,etc. as standart function keys"

Keyboard

That disabled the usual Sound, brightness, etc. functionality on my Mac book pro but that’s OK with me – pressing fn +F1… will give me that back. This setting helped for most of the F keys but not for F11, F12.

After digging more, I found:

Settings > Keyboard > Shortcuts > 
uncheck: Show Desktop and Show Dashboard

Keyboard2

unchecking them solved my problem.

Now all my windows working habits are usable in my OSX.

I hope this saves you time.

P.S. As you probably noticed this will work for any version of visual studio or any software that uses F11, F12.

Visual Studio 2015, Mac OS and F12 (F11) not working

Creating new IIS site and ERROR ( message:Failed to add duplicate collection element “yoursite”. )

If you executed a command line to create a new website in IIS8 and encountered: ERROR ( message:Failed to add duplicate collection element “yoursite”. ) this is what fixed in my case.

After executing:

C:\windows\system32\inetsrv\appcmd.exe add site /name:YourSite /id:12 /bindings:"http/*:8099:"  /physicalpath:E:\inetpub\yoursite

It errored out with the message above, and I thought that there is already a site with this name. Searing and googling and checking %windir%\system32\inetsrv\config\applicationHost.config I found nothing!

The problem was not the name it was the id!

/id:12

So if you have duplicate id the error is the same as duplicate name.
EDIT: Change the id with some unused number and you are good to go.

I hope this saves you time!

Creating new IIS site and ERROR ( message:Failed to add duplicate collection element “yoursite”. )