El TecnoBaúl de Kiquenet

Kiquenet boring stories

Archive for 31 agosto 2012

Cómo activar Telnet en Windows 7

Posted by kiquenet en 31 agosto 2012

Windows 7 una de las características que por motivos de seguridad trae por defecto desactivado es el cliente de Telnet.

Para aquellos usuarios que necesitan activar Telnet en Windows 7:

  1. Abrir Panel de Control, Programas Y Características.
  2. Activar o desactivar las características de Windows.
  3. Activar la característica Cliente Telnet.
  4. Por último, aceptamos los cambios.

Posted in Uncategorized | Leave a Comment »

Add Farm Administrator by using STSADM

Posted by kiquenet en 28 agosto 2012


one day we lost access to ourSharePoint Central Administration. The reason of this was that someone deleted the BUILTIN\Administrators from the Farm Administrators group.

No problem, just add the BUILTIN\Administrators back to the Farm Administrators Group.

But how do you do this without access to the Central Administration?

Well, after some searching and googling I found a solution. You can use STSADM to add people to groups in a Site Collection and the Central Administration is just another Site Collection.

I know the suspense is killing you so here ‘s the STSADM command:

stsadm -o adduser -url http://server:12345 -userlogin BUILTIN\Administrators -useremail admin@company.com -group “Farm Administrators” -username “Administrators”

Referencias: http://www.sharepointology.com/setup/add-farm-administrator-by-using-stsadm/


Lo mejor es tirar de TechNet, es lo más completo http://technet.microsoft.com/es-es/library/cc303422

Desde la Administración Central de SharePoint >  Security> Manage the farm administrators group

New > Add Users

Posted in Scripts, Sharepoint | Leave a Comment »

Modificar programáticamente ProductCode de Setup Project

Posted by kiquenet en 17 agosto 2012

Existen varias alternativas:

Proyecto en VS .NET C#:

VS.NET Deployment Project Updater


En C# con expresiones regulares:


static void Main(string[] args)
string setupFileName = @"<Replace the path to vdproj file>";
StreamReader reader = File.OpenText(setupFileName);
string file = string.Empty;

Regex expression = new Regex(@”(?:\”"ProductCode\”" =
Regex expression1 = new Regex(@”(?:\”"UpgradeCode\”" =
file = reader.ReadToEnd();

file = expression.Replace(file, “\”ProductCode\” = \”8:{” +
Guid.NewGuid().ToString().ToUpper() + “}”);
file = expression1.Replace(file, “\”UpgradeCode\” = \”8:{“
+ Guid.NewGuid().ToString().ToUpper() + “}”);
// Close the file otherwise the compile may not work

TextWriter tw = new StreamWriter(setupFileName);
// close the stream

Programmatically change the ‘ProductName’, ‘ProductCode’, ‘UpgradeCode’ and ‘ShortCut’ depending on build Configuration.

  1. Select the “Setup Project” in vs2005 and press F4.
  2. Change the “PostBuildEvent” towscript “$(ProjectDir)UpdateMSI.vbs” “$(BuiltOuputPath)” “$(ProjectDir)” $(Configuration).
  3. Place the UpdateMSI.vbs file in “$(ProjectDir)”.
BuiltOuputPath = Wscript.Arguments(0)

ProjectDir = Wscript.Arguments(1)

Configuration = Wscript.Arguments(2)

ProductName = "MyApplication - " &amp; Configuration

ShortcutName = "MYAPP~2|" &amp; ProductName 'Check this with orca.exe

select case Configuration

case "Debug"

UpgradeCode = "{11A3CB76-5DAC-4B9F-A993-401BE1D95A9E}"

ProductCode = "{E1BFC46C-6226-459C-BC4F-8DE17888ED62}"

case "Test"

UpgradeCode = "{B15A5EAA-FA9C-4BB7-AD68-29DAE5C95846}"

ProductCode = "{F183C852-5DBC-498C-89F1-2D6CDFF515B6}"

case "Production"

UpgradeCode = "{E14EC8A9-FA0B-47B8-84EB-4EC7ED278E7E}"

ProductCode = "{016C6EF8-A23F-4822-96B2-E0A1D74641EE}"

case Else

end select

'guid = CreateObject("Scriptlet.TypeLib").Guid

'UpgradeCode = left(guid, len(guid) - 2)

Const msiOpenDatabaseModeTransact = 1

Dim propertyKey, propertyValue

Dim installer, database, view, record

Set installer = CreateObject("WindowsInstaller.Installer")

Set db = Installer.OpenDatabase(BuiltOuputPath, msiOpenDatabaseModeTransact)

Set view = db.OpenView("UPDATE Property SET Value = '" &amp; ProductName &amp; "' WHERE Property = '" &amp; "ProductName" &amp; "'")


Set view = db.OpenView("UPDATE Property SET Value = '" &amp; ProductCode &amp; "' WHERE Property = '" &amp; "ProductCode" &amp; "'")


Set view = db.OpenView("UPDATE Property SET Value = '" &amp; UpgradeCode &amp; "' WHERE Property = '" &amp; "UpgradeCode" &amp; "'")


Set view = db.OpenView("UPDATE Shortcut SET Name = '" &amp; ShortcutName &amp; "' WHERE Description = 'MyApplication Application'")


'Set view = db.OpenView("UPDATE Upgrade SET UpgradeCode = '" &amp; UpgradeCode &amp; "'")



Set installer = Nothing

Set db = Nothing

Set view = Nothing

Con MSBuild:

How to auto-increment assembly version using a custom MSBuild task


También hay herramientas de terceros como Stampver:




Posted in .NET, SetupProjects | Leave a Comment »

Setup Projects y scripts “uninstall”

Posted by kiquenet en 17 agosto 2012

If the user wants to uninstall the product, he can go to "Add/Remove Programs", or he can just double-click the uninstall.cmd. The contents are:

%windir%\system32\msiexec /x {CC3EB7BF-DD82-48B9-8EC5-1B0B62B6D285}

The GUID there is the ProductCode from the Setup Project in Visual Studio.


How can I dynamically generate a batch file that contains the ProductCode for the, at build time?

"Using Visual Studio 2005/2008, you don’t need to write any code to add a uninstall option for a Setup project (Yes I know some people can write code to do it)

1) In the Setup Project –> File System windows –> Right Click “File System on Target machine” –> add a Special Folder, select System Folder;

2) Into this system folder Add a file. Browse for msiexec.exe from local System32 folder and add it. Override default properties of this file as follows:

Condition:=Not Installed (make sure you put ‘Not Installed’ exactly like that, same case and everything), Permanent:=True, System:=True, Transitive:=True, Vital:=False.

3) Create a new shortcut under the ‘Users Program Menu’, Set Target to the System Folder which you created in the step 1. and point it’s at the msiexec.exe. Rename the shortcut to ‘Uninstall Your Application’. Set the Arguments property to /x{space}[ProductCode].

4) Build the project, ignore warning about the fact that msiexec should be excluded, DONT exclude it or the setup project wont build.

The ‘Not Installed’ condition and Permananet:=True ensure that the msiexec.exe is only placed into the system folder as part of the install IF it doesn’t aready exist, and it is not removed on an uninstall – therefore it;s pretty safe to ignore that warning and just go for it.


Otra opciones más enrevesadas:

1.) make your application read command line arguments, the code below is from a WPF project

public partial class App : Application


  void Application_Startup(object sender,StartupEventArgs e)


    for(int i = 0;i != e.Args.Length;++i)


      if(e.Args[i].Split(‘=’)[0].ToLower() == "/u")


        string guid = e.Args[i].Split(‘=’)[1];

        string path = Environment.GetFolderPath(Environment.SpecialFolder.System);

        ProcessStartInfo uninstallProcess = new ProcessStartInfo(path+"\\msiexec.exe","/x "+guid);







To add the uninstall link in the deployment project you just need to follow the steps below:

  1. Select your deployment project and go to the file system editor.
  2. Using the file system editor you navigate to the desired location of the install file.
  3. From the decired location you create a new shortcut to your primary output and name it Uninstall – or whatever else you would like.
  4. In the properties of the new shortcut you set the arguments property to /u=[ProductCode]

2.) creates an uninstall.cmd. It runs as a custom action during installation.

var fso, ts;
var ForWriting= 2;
fso = new ActiveXObject("Scripting.FileSystemObject");

var parameters = Session.Property("CustomActionData").split("|"); 
var targetDir = parameters[0];
var productCode = parameters[1];

ts = fso.OpenTextFile(targetDir + "uninstall.cmd", ForWriting, true);

ts.WriteLine("@echo off");
ts.WriteLine("goto START");
ts.WriteLine(" Uninstall.cmd");
ts.WriteLine("@REM The uuid is the 'ProductCode' in the Visual Studio setup project");
ts.WriteLine("%windir%\\system32\\msiexec /x " + productCode);

Una buena referencia para Extending VS Setup Projects:


Gran referencia que explica en detalle los Setup Projects: PackageCode, ProductCode, UpgradeCode, herramienta Orca, etc.






Posted in .NET, SetupProjects, VisualStudio | Leave a Comment »

Paint.NET Portable using IExpress

Posted by kiquenet en 16 agosto 2012

a useful tool for compressing these files into a self-extracting executable, and it has shipped with Windows for quite some time: iexpress.exe.

Its purpose is to extract files and run a setup application, but nothing precludes it from running another application such asPaint.NET.exe. Run iexpress.exe which starts a simple wizard. The most important steps to remember are to have it executePaint.NET.exe, and to store the files using long names. The latter step will prevent the package from running on Windows 95, but the .NET Framework 2.0 which at least Paint.NET v2.62 requires isn’t supported on Windows 95 anyway.

The result was a 595 KB executable. It quickly extracts the files to a sub-directory under %TMP% and runs Paint.NET.exe. When you close Paint.NET.exe the temporary files are cleaned-up. Sure, better compression rates are likely possible using different tools but this is a good start to compress Paint.NET even more without adding extra steps to start the application.



Posted in Herramientas | Leave a Comment »