Tuesday, October 02, 2012

DsGetDCName() sample


The API function DSGetDCName() is a recommended way to obtain the domain controller name by domain name etc.
Calling this function one should take care about combination of used flag combination: this is mostly the point of optimization.
To let the developer experiment with the flags I’ve build a quick app helping to check different flag combinations:
image
Bits and source code are available on request or here.
Enjoy!

Sunday, September 02, 2012

“Base system device” problem, missing driver and “PCI-Bus 2 Device 6 Function 4” location

After a clean Windows installation on HP 6910p notebook with all the drivers from accompanying DVD there was still a “yellow” node in device tree with an unrecognized base system device (the system is localized in german, so the screenshots are in german as well)
Aufzeichnen1

The unrecognized device is located at “PCI Bus 2, Device 6, Function 4” (in german - PCI-Bus 2, Gerät 6, Funktion 4).

Neither Windows Updates nor scan the driver DVD gave answer what device isn’t recognized.

SiSoftware Sandra detected in the notebook the PCI buses and their characteristics:

Aufzeichnen2

Next step – detect the attached device and read it’s characteristics:

Aufzeichnen3

So, the unrecognized device is the “Ricoh MMC Bus Host Adapter”.

The matching driver was found on the HP driver download page

image

Download, install, restart, enjoy!

Aufzeichnen

Monday, August 27, 2012

Install and configure TFS 2012 Express on a standalone server

 

Prerequisites

Use Windows Server 2008 R2 Standard SP1 computer (a virtual machine as well) with most recent required updates.

Install application server role (full IIS support recommended).

Create two OS accounts for TFS services (recommended): TFS service itself and TFS build service.

clip_image001

clip_image002

Download TFS Express ISO image (<450MB)

http://www.microsoft.com/visualstudio/11/en-us/downloads#tfs-express

and attach it to TFS server (as Image or as burned CD).

Setup

Start tfsexpress if not launched automatically.

clip_image003

clip_image004

Accept the license and install.

clip_image005

clip_image006

Setup starts.

clip_image007

Confirm automatic restart of the server if required.

After server restarts, the setup continues.

clip_image008

Setup will try to download latest updates after succeeded finish (will fail if there’s no internet connection available).

clip_image009

TFS service configuration

After setup wizard closes, the next wizard starts automatically – the configuration wizard.

clip_image011

Confirm wizard start.

clip_image013

Change TFS Service account context (recommended) using TFS Service account created above – click “Change”.

clip_image014

Enter account name and password, check entered data clicking “Test”.

Change default port number (8080) if required.

clip_image016

Verify changes made or continue directly.

clip_image018

Pre-configuration starts.

clip_image020

Start final configuration with “Configure”.

clip_image022

Configuration finalizing starts.

clip_image024

After configuration finishes continue with “Next”.

clip_image026

The final screen displays the URL to access TFS service (here http://tfsexpress:8080/tfs).

Click on the URL brings opens internet browser (here Internet Explorer, confirmation to unblock web address may appear).

clip_image027

Click “Add” to include the TFS service URL in the list of trusted URLs.

The Web frontend of TFS Service opens.

clip_image029

The wizard can be closed. Alternatively TFS build service may be configured from now.

clip_image031

TFS build service configuration

clip_image033

Continue the wizard with “Next”.

clip_image035

Change the project collection if not the default collection is to be used.

clip_image037

Configure number of build agents.

clip_image039

Change TFS build service account context (recommended) using TFS build service account created above, click “Test” to verify entered data.

clip_image041

Ensure test of entered account data succeeded, continue wizard.

clip_image043

Confirm the configuration settings or verify if required.

clip_image045

After validation of the settings start configuration with “Configure”.

clip_image047

Configuration starts.

clip_image049

After configuration finishes finish the setup with “Next”.

clip_image051

Review setup summary on the final screen.

Finalization

clip_image053

After TFS build service configuration finishes check the summary on the final wizard screen and close the wizard.

clip_image055

TFS express administration console open immediately.

From now you can start to use your fresh TFS express instance and enjoy it!

Friday, August 10, 2012

Check and download Windows updates online for domain member computers

Most administrators configure group policy to use a domain internal Windows Update Server (WSUS), so if you take your domain member computer off the domain network (assume notebook or virtual machine image), the system won’t be updated reporting error: cannot check for updates or cannot download updates.

Windows Update control panel displays following information:
image

You receive updates:” is configured as “Managed by your system administrator” and “Check online for updates from Microsoft Update” is disabled/grayed out.

The reason is mostly configured group policy, pointing to use a domain update server (WSUS server) as update source.

You can revert your box to get updates online instead of looking for (temporarily?) unavailable update server.

Open regedit on the box and change following registry value

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\UseWUServer

to 0

image 

and retry check for updates:

image

Refer also Microsoft KB http://support.microsoft.com/kb/328010 and enjoy!

Thursday, August 09, 2012

“Go online” problem with Windows Live Mail and MESH (Windows Live Essentials) on Windows 8

 

After enabling Hyper-V feature and configuring Virtual Switch on Windows 8 box we encountered very strange problem: after click on “Work offline” in Windows Live Mail window - globe button clip_image001– the program won’t go back online. Each click on clip_image001[4] “Go online” is followed by

clip_image001[6]

MESH also declines to start saying “There’s no internet connection” or similar.

Workaround:

  1. Close and exit Windows Live Mail and Mesh if running.
  2. Start Internet Explorer.
  3. Ensure “go online” notification on the bottom of internet explorer and DO NOT CLICK “Go back offline” – simply close it.
    clip_image001[8]
  4. Restart Windows Live Mail – you will see, Windows Live Mail went automatically online.
  5. Restart Mesh
  6. Enjoy!

Wednesday, August 08, 2012

Protect ASP.NET application against No-Redir browser hacks

 

Page redirection is a very popular approach on Web applications behavior, for example: count login errors and redirect user to an error page if login error count exceeds max allowed value – to prevent login hack attack.

The simplest way to do it in a ASP.NET application:

// Get URL of the error page to be redirected to
string urlErrorPage = getUrlErrorPage(…);

// Use Response.Redirect to redirect user to the error page
Response.Redirect(urlErrorPage, true);
The problem is, there are numerous add-ons for internet browsers to prevent redirection: like this, this and this.
One possibility to redirect mandatory is to write the content of target page in Response directly (the target page assumed to be plain HTML page):
// Use Response.Write to write error page content
string errorContent = "<html><head></head><body>error</body></html>";
string sFile = null;
try
{
sFile = Server.MapPath(urlErrorPage);
using (StreamReader sr = new StreamReader(sFile))
{
errorContent = sr.ReadToEnd();
}
}
catch (Exception ex)
{
// Handle exception
}
finally
{
Response.Write(errorContent);
Response.End();
}

Once again: the target error page assumed to be (D)HTML page.


Enjoy!

Monday, August 06, 2012

Windows Server 2012 is RTM now

 

For anyone, who doesn’t follow MSDN news: WS2012 is RTM.

Stay online with TechNet evaluation center and enjoy!

UPD: do not miss 4th September – Windows Server 2012 availability start

UPD: do not miss Windows Server 2012 Essentials (currently beta)

Saturday, August 04, 2012

GhostScript error using FreePDF with network share

Some workstations in a Windows Domain (checked with SBS 2003 latest SP and Windows Server 2008 R2 latest SP) have problem saving PDF documents from FreePDF printer.

One of the reason: network share as destination folder – the document is created but copy to the target folder fails generating GhostScript error message.

Workaround: save result PDF document to a local folder and the copy to network share destination.

Enjoy!

UPD: same behavior was seen using CutePDF or Bullzip PDF

Wednesday, August 01, 2012

Problem: "The user name or password is incorrect" if you try to connect to SBS 2003 based network share or Exchange via Outlook

 

Situation: there is a number of client computers in a local SBS 2003 based domain. Every computer but one is domain member and runs Windows XP SP3. All users have access to network share (via explorer) and mailboxes (via Outlook 2003/2010) on the SBS 2003 SP2 server in the domain.

Suddenly the only non-domain computers – a workgroup computer – gets no access to network share and to Exchange mailbox. The user gets repeating error message

"The user name or password is incorrect"

The same username/password pair succeeds on every other computer in the LAN.

The most popular problem is: the clock on the client computer and on the serve are not synchronized. In our case: somebody misconfigured client’s date/time setting the next month as current, so the date/time difference between client and server was 1 month.

After setting client’s date/time same as on the server the access to network shares and Exchange account via Outlook was restored immediately.

So, in case of same or similar error message

  • check the date/time settings on the server
  • check the date/time settings on the client computer
  • compare and synchronize them if required

Enjoy!

Monday, July 30, 2012

Writing this post from Windows 8 To Go

Amazing! I enjoy my Windows 8 To Go on single USB stick.

image

First impressions: Windows 8 Enterprise

image

on a 16 GB RAM box uses 23 GB of 32 GB USB Disk

image

with following software/features installed on Win8:

  • Hyper-V Management Tools (to control my GUI-less Windows Hyper-V Server)
  • MS System Center 2012 Endpoint Protection
  • MS Office 2010 Professional Plus 2010
  • Skype
  • Windows Live Essentials