Wednesday, October 20, 2010

.Net Framework remote cleanup and installation

There are several reasons that lead to the corruption of installed .Net Framework on a machine running Microsoft Windows operating system, corruption of .Net Framework could leads to initiation failure problem for .Net Framework dependent applications like KBOX Agent and KBOX Agent debugger.

 

However this problem could be solved by uninstalling all versions of .Net Framework from effected machine and reinstalling .Net Frame required versions.

In some corruption cases, .Net Framework got corrupted in such a way that cannot be fixed by regular reinstallation procedure, or uninstall/reinstall ends up with an exception message.

This post describes how to encounter such .Net Framework corruption issue and get KBOX Agent running on client machines. This post describes the use of tools and procedures that can fix a local machine as well as large number of machines on remote locations, by using authenticated remote cleanup of corrupt .Net Framework version and push installation of .Net Framework version 1.1 that is prerequisite for KBOX Agent.


Problem Identification

From a KBOX administrator prospective, you may experience that some of the clients are not get connected for a long period of time, or clients are connected but are not getting refreshed inventory for an abnormal period of time.
If you can get an active ICMP response (PING response) then, it could be a corrupted .Net framework issue.

Solution

There are several .Net framework version could be installed and corrupted on a client machine, to fix the issue we must have to uninstall all of them in descending order of version number then install .Net Framework 1.1, that is prerequisite for KBOX Agent.
For remote cleanup of .Net Framework you need:
  • A shared folder on network that is accessible for target client machine
  • Target client machine Administrative access
  • A source machine to initiate the remote cleanup and reinstall process
  • Attached SharedFolder.rar
  • Attached SourceMachine.rar
  • WinRAR application to extract attached files



Steps

  1. Extract SharedFolder.rar to the network shared folder, make sure that target client machine can access the files on shared folder without any requirement to enter access credentials (you can accomplish it by granting Read Permission to Everyone Group).
  2. Extract SourceMachine.rar to any drive of your machine.
  3. Double click and run PSExec.exe and accept the agreement.
  4. PING target machine to ensure connectivity.
  5. Run following commands on windows command line after changing directory to SourceMachine.rar folder, after replacing sample values with real values (You must have run the following command in descending order of .Net Framework versions, each of the command written below may run up to several minutes, please be patient)


Sample ValueDescription to change the sample value to real value
192.168.1.209Target client machine’s IP address or DNS Name
TEST4SIGHT\administratorDomain Name\User Name (User must have administrative access on target machine)
123456Password of above mentioned user
dc1Shared folder machine’s IP address or DNS Name
framework_cleanupFolder network share name where you extracted the SharedFolder.rar


To Cleanup .Net Framework 4.0

D:\>psexec \\192.168.1.209 -u TEST4SIGHT\administrator -p 123456 \\dc1\\framework_cleanup\cleanup11.bat

To Cleanup .Net Framework 3.5

D:\>psexec \\192.168.1.209 -u TEST4SIGHT\administrator -p 123456 \\dc1\\framework_cleanup\cleanup35.bat

To Cleanup .Net Framework 3.0

D:\>psexec \\192.168.1.209 -u TEST4SIGHT\administrator -p 123456 \\dc1\\framework_cleanup\cleanup30.bat

To Cleanup .Net Framework 2.0

D:\>psexec \\192.168.1.209 -u TEST4SIGHT\administrator -p 123456 \\dc1\\framework_cleanup\cleanup20.bat

To Cleanup .Net Framework 1.1

D:\>psexec \\192.168.1.209 -u TEST4SIGHT\administrator -p 123456 \\dc1\\framework_cleanup\cleanup11.bat

To Cleanup .Net Framework 1.0

D:\>psexec \\192.168.1.209 -u TEST4SIGHT\administrator -p 123456 \\dc1\\framework_cleanup\cleanup10.bat

Result

If cleanup tool find the targeted version of .Net Framework on target machine it will normally uninstall it and give Error Code 0 on console (see below):
\\dc1\\framework_cleanup\cleanup11.bat exited on 192.168.1.209 with error code 0
If you get other error codes it means that Framework is failed to uninstall due to absence of targeted version or some program is currently using it, you may try this command on a later time when machine is idle and no application is running, you can restart that machine to close all running application forcefully.

  1. Run following commands on windows command line after changing directory to SourceMachine.rar folder, after replacing sample values with real values



Sample ValueDescription to change the sample value
192.168.1.209Target client machine’s IP address or DNS Name
TEST4SIGHT\administratorDomain Name\User Name (User must have administrative access on target machine)
123456Password of above mentioned user
192.168.1.200KBOX server’s IP address or DNS Name

Note: Following command may run up to several minutes, please be patient.

psexec \\192.168.1.209 -u TEST4SIGHT\administrator -p 123456 \\192.168.1.200\client\agent_provisioning\windows_platform\dotnetfx /q /c:"install /q"

Result

If push install command normally install .Net Framework, it will Error Code 0 on console (see below):
\\192.168.1.200\client\agent_provisioning\windows_platform\dotnetfx exited on 192.168.1.209 with error code 0.
  1. Open KBOX web administration portal and initiate push agent process on target machine

Thursday, October 14, 2010

Domain Driven Design (DDD) implementation using C# and LINQ

The part of the software that specifically solves problems from the domain model usually constitutes only a small portion of the entire software system, although its importance is disproportionate to its size. To apply our best thinking, we need to be able to look at the elements of the model and see them as a system.We must not be forced to pick them out of a much larger mix of objects, like trying to identify constellations in the night sky.We need to decouple the domain objects from other functions of the system, so we can avoid confusing domain concepts with concepts related only to software technology or losing sight of the domain altogether in the mass of the system. Domain-Driven Design: Tackling Complexity in the Heart of Software, by Eric Evans 
(Addison-Wesley, 2004)

Aggregates and Simplification
The DDD way to break down this complexity is to arrange domain entities into groups
called aggregates.
Each aggregate has a root entity that defines the identity of the whole aggregate, and acts
as the “boss” of the aggregate for the purposes of validation and persistence. The aggregate is
a single unit when it comes to data changes, so choose aggregates that relate logically to real
business processes—that is, the sets of objects that tend to change as a group (thereby embedding
further insight into your domain model).
Objects outside a particular aggregate may only hold persistent references to the root
entity, not to any other object inside that aggregate (in fact, ID values for non-root entities
don’t even have to be unique outside the scope of their aggregate). This rule reinforces
aggregates as atomic units, and ensures that changes inside an aggregate don’t cause data
corruption elsewhere.

In our example we have 3 aggregates (Customer,Store and Item)


code file password (asadyousufi.blogspot.com)

Followers

Search This Blog