El TecnoBaúl de Kiquenet

Kiquenet boring stories

Archive for the ‘Trucos’ Category

Modify Local Security Policy

Posted by kiquenet en 29 abril 2014

In Windows Server 2012.

In Administrative Tools folder, double click the Local Security Policy icon, expand Account Policies and click Password Policy.

In the right pane double click Password must meet complexity requirements and set it to Disabled. Click OK to save your policy change.

Optionally you can also choose to never let passwords expire. To do this open the Maximum password age policy and set set the value to 0. Click OK to apply the change.

Note: Just make sure to update the GP. go to Command Prompt and type GPUPDATE /FORCE

Programmatically:

http://stackoverflow.com/questions/23260656/modify-local-security-policy-using-powershell

secedit /export /cfg c:\secpol.cfg
(gc C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:\secpol.cfg
secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY
rm -force c:\secpol.cfg -confirm:$false


http://vlasenko.org/2011/04/27/removing-password-complexity-requirements-from-windows-server-2008-core/
secedit /export /cfg c:\new.cfg
${c:new.cfg}=${c:new.cfg} | % {$_.Replace('PasswordComplexity=1', 'PasswordComplexity=0')}
secedit /configure /db $env:windir\security\new.sdb /cfg c:\new.cfg /areas SECURITYPOLICY
del c:\new.cfg
 
Referencias:
http://www.win2012workstation.com/password-restrictions/
http://windowsitpro.com/blog/securing-services-powershell
http://sqldbamusings.blogspot.com.es/2012/03/powershell-adding-accounts-to-local.html
http://code.msdn.microsoft.com/windowsdesktop/Add-log-on-as-a-service-a64dd63c
 
Anuncios

Posted in PowerShell, Scripts, Trucos, Windows | Etiquetado: , | Leave a Comment »

Automatización en envío de correo: Send Automated Emails using SendEmail and Windows Task Scheduler

Posted by kiquenet en 28 enero 2014

Se puede automatizar el envío de correos aplicando Tareas Programadas de Windows y el comando SendEmail.exe.

Para crear tareas programadas (tasks scheduler) se utiliza el comando schtasks.exe o Start->Programs->Accessories->System Tools->Task Scheduler

Con el comando SendEmail.exe podemos configurar el envío de correos:

Examples below.

  • -f xxxxx@gmail.com : This parameter is the email address that will be the “sender.”
  • -t rdube@yahoo.com : This is the recipient’s email address.
  • -u Monday Status Updates : This is the subject
  • -m Here’s the analytics data for this week! : This is the message body.
  • -a Analytics_Channel1.csv Analytics_Channel2.csv Analytics_Channel3.csv : These are the attachments.
  • -s smtp.gmail.com:587 : SMTP server and port
  • -xu xxxxx@gmail.com : SMTP authentication ID name
  • -xp A1ienz2A51 : SMTP authentication password
  • -o tls=yes : SMTP uses TLS (or SSL)

.

sendmail2   Send Automated Emails Using SendEmail & Windows Task Scheduler

sendmail3   Send Automated Emails Using SendEmail & Windows Task Scheduler

sendmail4   Send Automated Emails Using SendEmail & Windows Task Scheduler

Referencias:

http://www.makeuseof.com/tag/send-automated-emails-save-time-sendemail-windows-task-scheduler/
http://caspian.dotconf.net/menu/Software/SendEmail/

http://www.makeuseof.com/tag/how-to-automate-windows-programs-on-a-schedule/

Posted in Scripts, Trucos | Etiquetado: , , | Leave a Comment »

Sleep command in batch file

Posted by kiquenet en 28 enero 2014

On Windows Vista / Windows 7 you can use the timeout command:

timeout /T [delay in seconds] /NOBREAK > NUL

On previous versions of Windows, you can use the ping command (the ping command has 1000 ms of delay between each iteration):

ping -n [delay in seconds + 1] 127.0.0.1 > NUL

Note: As TCP/IP is now ubiquitous, using ping will usually work, but only if TCP/IP is used (a client Windows machine could use NetBEUI or IPX/SPX instead).

Some versions of Windows (like Windows Server 2003) has the sleep.exe executable:

sleep [delay in seconds]

Note: Windows Resource kit for 2003 (http://www.microsoft.com/en-us/download/details.aspx?id=17657) contains sleep.exe command.

Referencias:
http://malektips.com/xp_dos_0002.html

http://stackoverflow.com/questions/7958265/sleep-command-in-batch-file
http://stackoverflow.com/questions/166044/sleeping-in-a-batch-file

Posted in Scripts, Trucos | Etiquetado: , , | Leave a Comment »

Logs de IIS

Posted by kiquenet en 27 enero 2014

Ruta por defecto:

c:\inetpub\logs\LogFiles


Nota:

Otherwise, check under IIS Manager, select the computer on the left pane, and in the middle pane, go under "Logging" in the IIS area. There you will se the default location for all sites (this is however overridable on all sites)


También pueden encontrarse en siguientes rutas: C:\Windows\system32\LogFiles\W3SVC1

En esta ruta un log que contiene sólo los errores:

C:\Windows\System32\LogFiles\HTTPERR

Comprobar que esté activo:

Programs and Features

then click on

Turn Windows features on or off

on the left side then select

Internet Information Services\World Wide Web Services\Health and Diagnostics\HTTP Logging

Una referencia interesante, y que trata de la configuración de logs en IIS (sección <logFile> de settings)

http://www.iis.net/configreference/system.applicationhost/sites/sitedefaults/logfile

Referencias:

http://stackoverflow.com/questions/6426375/where-can-i-find-the-iis-logs

http://techslate.net/es/cas-server-and-using-and-troubleshooting-iis-log-files/

http://www.iis.net/configreference/system.applicationhost/sites/sitedefaults/logfile

Posted in IIS, Trucos | Etiquetado: , | Leave a Comment »

Múltiples cuentas en Skype (Portable)

Posted by kiquenet en 6 junio 2013

The text in the Target field of this shortcat(s) should look like this:

X:\PortableSkype\Skype.exe  /datapath:"Data"  /removable  /secondary

where X:\PortableSkype is the folder where Skype.exe file is located in your Portable installation.

You can create as many new shortcuts as you wish and with each login with the respective account. You can actually add the Skype name and password to the path, so the shortcut will automatically login to the selected account.

E:\Portables\SkypePortable\App\Skype\Phone\Skype.exe  /datapath:”Data”  /removable  /secondary  /username:name1  /password:password1

E:\Portables\SkypePortable\App\Skype\Phone\Skype.exe  /datapath:”Data”  /removable  /secondary  /username:name2  /password:password2

E:\Portables\SkypePortable\App\Skype\Phone\Skype.exe  /datapath:”Data”  /removable  /secondary  /username:name3  /password:password3

for MSN account like xxxx@hotmail.com ?

I’m afraid that this will not work with MSN accounts, but you can try.

In any case, in order to be able to login with MSN account, \ProgramData\Skype\Apps\login folder must be present on the computer. Per default, the Portable installation does not install this folder.

http://community.skype.com/t5/Windows-desktop-client/Running-multiple-skype-accounts-using-Skype-Portable/

https://support.skype.com/en/faq/FA829/how-can-i-run-two-skype-accounts-on-the-same-computer

Posted in Trucos | Etiquetado: , , , | Leave a Comment »

Hide or Show the Solution File in Solution Explorer

Posted by kiquenet en 31 octubre 2012

If you don’t like seeing the solution file in Solution Explorer, you can easily hide it (or show it if you have it hidden).  First, let’s review what the default looks like with the solution file showing:

image

Now if we go to Tools -> Options -> Projects and Solutions -> General and uncheck "Always show solution":

image

This is the result:

image

SPECIAL NOTE:  This only works when there is one project in the solution.  If you have multiple projects in your solution it will ignore this setting and give you the default view.

http://blogs.msdn.com/b/zainnab/archive/2010/03/26/hide-or-show-the-solution-in-solution-explorer-vstipproj0008.aspx

http://stackoverflow.com/questions/7457935/solution-folder-not-showing-in-visual-studio-2010-how-can-i-make-it-visible

http://yellowduckguy.wordpress.com/2007/07/07/how-to-always-show-solution-within-solution-explorer-with-visual-studio-2005/

Posted in .NET, Trucos, VisualStudio | Etiquetado: , | Leave a Comment »

Conexiones Activas en SQL Server

Posted by kiquenet en 12 agosto 2011

Muchas veces necesitamos saber cuántas conexiones están activas en nuestro servidor SQL Server. Para ello podemos utilizar el siguiente script que nos permitirá saber la cantidad de conexiones existentes por cada base de datos y el login utilizada para las mismas.

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

 

fuente: mnoguera.com.ar

Posted in SQL, Trucos | Etiquetado: | Leave a Comment »

msvcr71.dll is missing

Posted by kiquenet en 5 agosto 2011

Install SQL Developer on Win 7 64 bit (o 32 bit) might get this error,

The program can’t start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem.

Just follow the instruction at to fix it

http://i.justrealized.com/2009/how-to-fix-missing-msvcr71dll-problem-in-windows/

También puede descargarse (free) desde esta dirección:

http://www.dll-files.com/dllindex/dll-files.shtml?msvcr71

y después copiar la dll en C:\Windows\system32.

http://support.microsoft.com/kb/326922

  • Msvcr80.dll para Microsoft Visual C++ 2005
  • Msvcr71.dll para Microsoft Visual C++ .NET 2003 con Microsoft .NET Framework 1.1
  • Msvcr70.dll para Microsoft Visual C++ .NET 2002 con Microsoft .NET Framework 1.0

Referencias: http://tranminhan.wordpress.com/2011/04/05/4380760628/

http://stackoverflow.com/questions/4941395/how-can-i-distribute-msvr71-dll-microsoft-visual-c-runtime-dll

Posted in Trucos | Leave a Comment »

Xcopy: Insufficient Memory

Posted by kiquenet en 31 enero 2011

El comando xcopy de Windows tiene ciertas limitaciones.

Al copiar una enorme cantidad de ficheros pueden aparecer errores del tipo “Insufficient Memory”.

rmdir /S /Q "%HOMEPATH%\My Documents\Important"

xcopy /E /R /Y /I G:\Important "%HOMEPATH%\My Documents\Important"

 

Insufficient Memory

Básicamente, hay 3 workarounds para solucionarlo:

  1. Fix paths – Se puede intentar usar unidades virtuales para acortar los paths.
  2. Usar xxcopy – Comando de terceros, clon de xcopy. It was sugerido por David at blogdom.org. Para propósitos comerciales es de pago.
  3. Usar robocopy – Robocopy es parte del Windows Server 2003 Resource Kit. Sólo se instala para Windows XP y 2003, pero funcionará en máquinas compatibles NT (copiando robocopy.exe en las máquinas que lo necesiten).
  4. Otras herramientas (gráficas): Teracopy (comentada por el compañero P.Hevia) , o RichCopy (que apareció en Technet Magazine)

 

Ejemplos:

robocopy \\server\share\Important "%HOMEPATH%\My Documents\Important"

"%ProgramFiles%\Windows Resource Kits\Tools\robocopy" C:\Temp\TeamProject\Main C:\Tmp\TeamProject\MainBuild\Sources\Main /S /E

http://www.terminally-incoherent.com/blog/2007/02/05/xcopy-insufficient-memory/

http://www.blogdom.org/archives/000792.php

http://forums.wincustomize.com/314765

http://technet.microsoft.com/en-us/magazine/2009.04.utilityspotlight.aspx

Posted in Scripts, Trucos | Etiquetado: | Leave a Comment »

Detecting if Code is Running from the IDE

Posted by kiquenet en 1 diciembre 2010

During development, you may find that you need your code to determine if is running from the IDE or standalone.

Unlike previous Microsoft development platforms like VB 6, .NET assemblies don’t have a different “mode” when running from the IDE or from the command line. This can make it difficult to figure out how to determine if an assembly is running from the IDE (i.e. from within Visual Studio .NET).

There are several methods of accomplishing this. The simplest is to use the System.Diagnostics.Debugger.IsAttached property to determine if there is a .NET debugger attached to the currently executing code. If there is, you can assume the code is running from the IDE:

// C#

if (Debugger.IsAttached = true)

      {

// Since there is a debugger attached,

// assume we are running from the IDE

      }

else

      {

// Assume we aren’t running from the IDE

      }

‘ Visual Basic.NET

If Debugger.IsAttached Then

‘ Since there is a debugger attached,

‘ assume we are running from the IDE

Else

‘ Assume we aren’t running from the IDE

End If

User Controls in Runtime Mode

There are also issues with creating your own controls. In some cases, you have code that should not execute in design mode, but should in run mode. In this case, simply use the DesignMode property of the object:

// C#

if (this.DesignMode() = true)

      {

// The component is in design mode

      }

else

      {

// The component is in run mode

      }

‘ Visual Basic.NET

If Me.DesignMode Then

‘ The component is in design mode

Else

‘ The component is in run mode

End If

http://www.fmsinc.com/free/NewTips/NET/NETtip32.asp

Posted in .NET, Trucos | Etiquetado: , | Leave a Comment »