Friday, September 28, 2007

Limpiar log de bd con mirroring

Estos comandos permiten limpar el log de una bd que tiene mirroring configurado


Vea que se hace shink sobre el log no sobre la BD.

Wednesday, September 26, 2007

Error en IIS Could not create a Disk Cache Sub-directory

Cuando se presenta este error en IIS:

Error: The Template Persistent Cache initialization failed for Application Pool ‘DefaultAppPool’ because of the following error: Could not create a Disk Cache Sub-directory for the Application Pool. The data may have additional error codes..

Este error se presenta en Windows Server 2003 por falta de configuración de seguridad en Windows. Se tiene que dar permisos de full access a las cuentas IIS_WPG y Network Services, en seguridad de los siguientes directorios,

%systemroot%\System32\Inetsrv\ASP Compiled Templates
%systemroot%\IIS Temporary Compressed Files

Tuesday, September 18, 2007

Problemas de Virtual PC

This can happen if changes on one virtual computer are saved while changed on a different virtual computer are not saved, which causes the system account password to become unsynchronized. To disable system account password changes on London, add the RefusePasswordChange D_Word value of 1 in the Registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters. To prevent system account password change requests on Miami and Acapulco, set the DisablePasswordChange value to 1 at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters.

Wednesday, September 12, 2007

Microsoft IAG

IAG es una solución de seguridad de Microsoft para proveer acceso remoto basado en SSL, para más información ingresen a

Microsoft's Intelligent Application Gateway (IAG) 2007 is the comprehensive, secure remote access gateway that provides secure socket layer (SSL)-based application access and protection with endpoint security management. Read the resources listed below to learn how IAG 2007 enables granular access control, authorization, and deep content inspection from a broad range of devices and locations to a wide variety of line-of-business, intranet, and client/server resources.

• Control Access
Secure, browser-based access to corporate applications and data from more locations and more devices.

• Protect Assets
Ensure the integrity and safety of network and application infrastructure by blocking malicious traffic and attacks.

• Safeguard Information
Comprehensive policy enforcement helps drive compliance with legal and business guidelines for using sensitive data.

Tuesday, September 04, 2007

Fecha de expiracion desde VB.NET

Imports System.DirectoryServices
Imports System.Reflection

Public Shared Function PasswordExpiration() As DateTime

Dim user As DirectoryEntry
Dim root As DirectoryEntry
Dim rootDSE As DirectoryEntry

Dim defaultContext As String

Dim maxPwdVal As Object
Dim pwdLastSetVal As Object

Dim pwdLastSet As Int64
Dim pwdLastSetDate As DateTime
Dim pwdExpirationDate As DateTime
Dim maxPwd As TimeSpan

rootDSE = New DirectoryEntry("LDAP://RootDSE")

defaultContext = DirectCast(rootDSE.Properties("defaultNamingContext").Value, System.String)

'change this to point to the user you wish to check
user = New DirectoryEntry("LDAP://cn=pruebas,cn=Users," + defaultContext)
root = New DirectoryEntry("LDAP://" + defaultContext)

pwdLastSetVal = user.Properties("pwdLastSet").Value
maxPwdVal = root.Properties("maxPwdAge").Value

pwdLastSet = GetInt64FromLargeInteger(pwdLastSetVal)

If pwdLastSet <= 0L Then
Throw New InvalidOperationException("User's password either doesn() 't expire or has already expired.")
pwdLastSetDate = DateTime.FromFileTime(pwdLastSet)
maxPwd = New TimeSpan(GetInt64FromLargeInteger(maxPwdVal))

'these seem to be stored as negative numbers in AD, so I use Subtract instead of Add here...
pwdExpirationDate = pwdLastSetDate.Subtract(maxPwd)
End If

Return pwdExpirationDate

End Function

'Imports System.Reflection is implied here...

Public Shared Function GetInt64FromLargeInteger(ByVal largeInteger As Object) As Long
Dim lowPart As Integer
Dim lBytes() As Byte
Dim highPart As Integer
Dim hBytes() As Byte
Dim valBytes(7) As Byte

Dim longVal As Long
Dim largeIntType As Type

largeIntType = largeInteger.GetType()

highPart = CType(largeIntType.InvokeMember("HighPart", BindingFlags.GetProperty Or BindingFlags.Public, Nothing, largeInteger, Nothing), Integer)
lowPart = CType(largeIntType.InvokeMember("LowPart", BindingFlags.GetProperty Or BindingFlags.Public, Nothing, largeInteger, Nothing), Integer)

lBytes = BitConverter.GetBytes(lowPart)
hBytes = BitConverter.GetBytes(highPart)

lBytes.CopyTo(valBytes, 0)
hBytes.CopyTo(valBytes, 4)

longVal = BitConverter.ToInt64(valBytes, 0)

Return longVal

Catch e As MissingMethodException
Throw New ArgumentException("Invalid COM object passed as parameter. Object must be IADsLargeInteger.", e)
End Try
End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub

Obtener la fecha de expiracion de los passwords

Para obtener la fecha de expiracion de los password del usuario se puede utilizar el siguiente codigo.

' First, get the domain policy.
Dim oDomain As IADsContainer
Dim oUser As IADsUser
Dim maxPwdAge As LargeInteger

' Declaring numDays as Currency, due to a
' large number calculation.
Dim numDays As Currency

strDomainDN = "YOURDOMAIN"
strUserDN = strDomainDN & "/CN=John Doe,CN=Users,DC=YOURDOMAIN,DC=COM"

Set oDomain = GetObject("LDAP://" & strDomainDN)
Set maxPwdAge = oDomain.Get("maxPwdAge")

' Calculate the number of days that are
' held in this value.
numDays = ((maxPwdAge.HighPart * 2 ^ 32) + _
maxPwdAge.LowPart) / -864000000000@
Debug.Print "Maximum Password Age: " & numDays

' Determine the last time that the user
' changed his or her password.
Set oUser = GetObject("LDAP://" & strUserDN)

' Add the number of days to the last time
' the password was set.
whenPasswordExpires = DateAdd("d", numDays, oUser.PasswordLastChanged)

Debug.Print "Password Last Changed: " & oUser.PasswordLastChanged
Debug.Print "Password Expires On: " & whenPasswordExpires

' Clean up.
Set oUser = Nothing
Set maxPwdAge = Nothing
Set oDomain = Nothing

SQL Server 2016 Stretch Databases

El SQL Server Stretch Database permite que los datos históricos o de bitácoras puedan ser movidos hacia Azure, específicamente permite mover...