Thursday, November 26, 2009

Server Manager Command Line in Windows Server 2008

refer http://edge.technet.com/Media/539/

On the heels of yesterdays Windows Server 2008 RTM announcement is a closer look at a new command line based management tool in Windows Server 2008: Server Manager Command. This tool allows, among other things, for unattended installation, configuration, and removal of roles and features in Windows Server 2008.

Who’s it for? IT Professionals who install and manage server roles and features.

What does it do?

· Installs and removes server roles and features via a command line.

· Displays roles and features installed on a server

· Allows for viewing the output of the tool in XML

· Query what dependencies will be installed with any given role or feature.


e.g. I want to install Windows PowerShell feature, then I just need to type following command in a command line winodw

servermanagercmd.exe -i PowerShell

You can get all roles and features list via command

servermanagercmd.exe -q

Thursday, August 13, 2009

How to use apt-get behind proxy server (Ubuntu/Debian)


If you’re using command-line apt-get


Edit your /etc/bash.bashrc file as root.


Put these line at the end of your /etc/bash.bashrc file :

export http_proxy=http://username:password@proxyserver.net:port/
export ftp_proxy=http://username:password@proxyserver.netport/

You can omit the username:password, if your proxy server has no password. That’s all for today! Happy apt-get-ing!


debian,ubuntu,knoppix, mepis, apt-get


Wednesday, August 5, 2009

how to create aspnetdb.mdb database

normal way is launching Visual Studio Prompt and execute aspnet_regsql, and follow subsequence wizard window.

Another way is to generate SQL to create tables and view to the DB you want, and change connection string in web.config. In this way, you can separate personnel information for each individual web application.

  1. aspnet_regsql.exe -A all -sqlexportonly C:\runproviders.sql
  2. open C:\runproviders.sql and replace database name with the one you will use.
  3. connect to SQL server with management tool and execute upper script.
  4. change connection string in web.config


<connectionStrings>
<remove name="LocalSqlServer" />
<add name="classifiedsConnection" connectionString="Data Source=ITDEVSQL01;Initial Catalog=ASPNETDB;Integrated Security=True;" providerName="System.Data.SqlClient" />
<add name="LocalSqlServer" connectionString="Data Source=ITDEVSQL01;Initial Catalog=ASPNETDB;Integrated Security=True;" providerName="System.Data.SqlClient" />
</connectionStrings>

Tuesday, July 14, 2009

powershell to deploy web application

following script will
  • Create an application pool, it to use 32 bit on x64, change it to use classic pipeline mode
  • Create a web application, point physical path to the path we created, specify the application pool we created, disable anonymous authentication and enable windows authentication
$appName = "IIS:\Sites\Default Web Site\DistributionService"
$appPoolPath = "IIS:\AppPools\DistributionService"
$appPath = "C:\inetpub\wwwroot\DistributionService"
$appLocation = "Default Web Site/DistributionService"
$appPoolName = "DistributionService"

md $appPath

new-item $appPoolPath
$appPool = Get-Item $appPoolPath
$appPool.enable32BitAppOnWin64 = "True"
$appPool.managedPipelineMode = "Classic"
$appPool | Set-Item

New-Item $appName -physicalPath $appPath -type Application
Set-ItemProperty $appName -name applicationPool -value $appPoolName

Set-WebConfigurationProperty -filter /system.webServer/security/authentication/anonymousAuthentication -name enabled -value false -PSPath IIS:\ -location $appLocation
Set-WebConfigurationProperty -filter /system.webServer/security/authentication/windowsAuthentication -name enabled -value true -PSPath IIS:\ -location $appLocation

Wednesday, May 20, 2009

splistitem update method

stolen from this blog

Method bSystem bPreserveItemVersion bNoVersion
SystemUpdate() true false false
SystemUpdate(false) true true false
UpdateOverwriteVersion() false false true
Update() false false false

UpdateOverwriteVersion is very useful when you want to migrate existing system to MOSS, and keep original date time information

Also be careful about build in MOSS column for document library.
MOSS display name MOSS internal name
Created Created
Created By Author
Modified Modified
Modified By Editor

Monday, May 18, 2009

Essential .NET Tools

he .NET Framework SDK contains many useful programming tools. Here, in an alphabetical list, are those we have found most useful or necessary for developing C# applications. Unless otherwise noted, the tools in this list can be found either in the \bin directory of your .NET Framework SDK installation or in the %SystemRoot%\Microsoft.NET\Framework\VERSION directory (replace VERSION with the framework version). Once the .NET Framework is installed, you can access these tools from any directory. To use any of these tools, invoke a Command Prompt window and enter the name of the desired tool. For a complete list of the available command-line switches for any given tool, enter the tool name (e.g., csc) and press the Return or Enter key.
ADepends.exe: assembly dependency list

Adepends displays all assemblies that a given assembly is dependent on to load. This is a useful C# program found among the samples in the \Tool Developers Guide directory beneath the .NET Framework or Visual Studio .NET directory tree. You need to install these samples before you can use them, because they are not installed by default.

Al.exe: assembly linking utility

Creates an assembly manifest from the modules and resources files you name. You can also include Win32 resources files. Here's an example:

al /out:c.dll a.netmodule b.netmodule
CorDbg.exe : runtime debugger

General source-level, command-line debug utility for MSIL programs. Very useful tool for C# source debugging. Source for cordbg is available in the \Tool Developers Guide directory.

Csc.exe: C# compiler

Compiles C# sources and incorporates resource files and separately compiled modules. Also allows you to specify conditional compilation options, XML documentation, and path information. Here are some examples:

csc foo.cs /r:bar.dll /win32res:foo.res
csc foo.cs /debug /define:TEMP
DbgClr.exe: GUI debugger

Windows-based, source-level debugger. Available in the \GuiDebug directory of the .NET Framework SDK installation.

GACUtil.exe: global assembly cache utility

Allows you to install, uninstall, and list the contents of the global assembly cache. Here's an example:

gacutil /i c.dll
ILAsm.exe: MSIL assembler

Creates MSIL modules and assemblies directly from an MSIL textual representation.

ILDasm.exe : MSIL disassembler

Disassembles modules and assemblies. The default is to display a tree-style representation, but you can also specify an output file. Here are some examples:

ildasm b.dll
ildasm b.dll /out=b.asm
InstallUtil.exe: installer utility

Executes installers and uninstallers contained within the assembly. A logfile can be written, and state information can be persisted.

Ngen.exe: native image generator

Compiles an assembly to native code and installs a native image in the local assembly cache. That native image is used each time you access the original assembly, even though the original assembly contains MSIL. If the runtime can't locate the native image, it falls back on JIT compilation. Here are some examples:

ngen foo.exe
ngen foo.dll
nmake.exe: make utility

Common utility that scripts building of multiple components and source files and tracks rebuild dependency information. See Appendix E for more information.

PEVerify.exe: portable executable verifier

Verifies that your compiler has generated type-safe MSIL. C# will always generate type-safe MSIL. Useful interop with ILASM-based programs.

RegAsm.exe: register assembly tool

Registers an assembly in the system registry. This allows COM clients to call managed methods. You can also use it to generate the registry file for future registration. Here's an example:

regasm /regfile:c.reg c.dll 
RegSvcs.exe : register services utility

Registers an assembly to COM+ 1.0, and installs its typelib into an existing application. Can also generate a typelib. Here's an example:

regsvcs foo.dll /appname:comapp /tlb:newfoo.tlb
Sn.exe : shared name utility

Verifies assemblies and their key information. Also generates key files. Here's an example:

sn -k mykey.snk
SoapSuds.exe: SoapSuds utility

Creates XML schemas for services in an assembly and creates assemblies from a schema. You can also reference the schema via its URL. Here's an example:

soapsuds
-url:http://localhost/myapp/app.soap?wsdl
-os:app.xml
TlbExp.exe : type library exporter

Exports a COM typelib derived from the public types within the supplied assembly. Differs from regasm in that it doesn't perform any registration. Here's an example:

tlbexp /out:c.tlb c.dll
TlbImp.exe: type library importer

Creates a managed assembly from the supplied COM typelib, mapping the type definitions to .NET types. You need to import this new assembly into your C# program for use. Here's an example:

tlbimp /out:MyOldCom.dll MyCom.tlb
Wsdl.exe: web services description language tool

Creates service descriptions and generates proxies for ASP.NET web-service methods. See the ASP.NET documentation in the .NET Framework SDK for more detail on web services.

WinCV.exe : windows class viewer

Searches for matching names within a supplied assembly. If none are supplied, it uses the default libraries. The namespaces and classes are displayed in a listbox, and the selected type information is displayed in another window.

Xsd.exe : XML schema definition tool

Generates XML schemas from XDR, XML files, or class information. Can also generate DataSet or class information from a schema. Here's an example:

xsd foo.xdr
xsd bar.dll
digest from http://ricin.lfsnal.org/books/oreilly/books/csharpess2/csharpess2_cnode80.html

Wednesday, April 8, 2009

How to disable Windows Desktop Search integration in Windows Explorer

In RegEdit, go to HKEY_CURRENT_USER\Software\Microsoft\Windows Desktop Search\DS and set "ShowStartSearchBand" to 0