sábado, 10 de julio de 2010

Error al iniciar JDownloader en Remote Desktop

Sin motivo alguno, tras funcionar durante meses de pronto un dia deja de iniciarse el JDownloader a traves de escritorio remoto.
Hay que aclarar tambien que es un Windows 7 con el parche para multiples sesiones concurrentes como un Terminal Server.

Parece que el problema es cuando incia el D3D asi que ahi va el comando para iniciar el JDownloader con el D3D desactivado.

java.exe -Xmx512m -Dsun.java2d.d3d=false -jar "C:\Program Files\JDownloader\JDownloader.jar"

jueves, 17 de junio de 2010

Como consultar Active Directory desde SQL

Ojo: Solo devuelve los primeros 1000 resultados


Primero creamos el servidor

EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5',

'ADSDSOObject', 'adsdatasource'

Despues creamos la cuenta de acceso

EXEC sp_addlinkedsrvlogin 'ADSI', False, 'SA POR EJEMPLO',

'DOMINIO\USUARIO', 'PASSWORD'



Despues ya podemos lanzar consultas con formato LDAP

SELECT samAccountName, givenName [First Name], sn [Last Name],

legacyExchangeDN

FROM OPENQUERY(ADSI,

'SELECT samAccountName,

givenName, sn, legacyExchangeDN

FROM ''LDAP://DC=dominio,DC=org''

WHERE objectClass=''Person''

AND objectClass = ''User''')

WHERE givenName IS NOT NULL

jueves, 27 de mayo de 2010

Camaras de Trafico Palma

http://www.mallorcaquality.com/agenda-cultural-mallorca/camaras-de-trafico/
http://www.conselldemallorca.net/?id_section=540&id_son=1223&id_parent=494&id_class=3003&id_lang=1

Agregar opcion 60 para PXE en un DHCP de 2003 Server

netsh
dhcp
server \\servidor
add optiondef 60 PXEClient STRING 0 comment=Soporte para PXE
set optionvalue 60 STRING 10.36.4.57

Tan complicado es hacer un GUI?

lunes, 3 de mayo de 2010

Listar / Modificar atributos objetos Active Directory

Para quitar permisos de marcado a todos los usuarios del dominio primero hacemos un listado para ver quien tiene esos permisos:

dsquery * -filter "&(msNPAllowDialin=TRUE)" -attr samaccountname

El reporte esta bien, pero a la hora de intentar modificar el atributo con dsmod resulta que no se pueden modificar mas que unos pocos atributos con esta herramienta.

Opciones:

Powershell, bastante tedioso hasta que salga el 2.0

Herramientas de terceros:

OJO, BACKUP PRIMERO, LOS RESULTADOS PUEDEN SER UN INFIERNO SI NOS EQUIVOCAMOS

adfind y admod.

Primero listado:
adfind -dn -f "&(msNPAllowDialin=TRUE)" > users.txt

No tengo tiempo de ver pq el output no es un DN puro.
Eliminar los dn: con los que comienza cada linea con un simple reemplazar del notepad

Cambiar el atributo que necesitamos en el listado de usuarios:
type users.txt | admod msNPAllowDialin::FALSE -safety (numero de registros)
type users.txt | admod msNPAllowDialin:- -safety (numero de registros)


OJO, SI QUEREMOS ELIMINAR EL VALOR DEL ATRIBUTO SIMPLEMENTE PONED -
SI QUEREMOS QUE SEA VERDADERO O FALSO :TRUE O :FALSE
Si queremos quitar atributos a una lista de usuarios y alguno ya tiene el atributo en blanco dara error. Rellenar con lo que sea primero o usad el parametro para continuar en caso de errores -cont


Ya que estamos pongo un par de consultas interesantes con el dsquery:

Ver todos los usuarios con su logon script asociado:
dsquery * domainroot -filter "(&(objectCategory=Person)(objectClass=User))" -limit 0 -attr sAMAccountName sn distinguishedName scriptPath

Ver todos los grupos que no tienen miembros:
dsquery * -filter "&(objectCategory=group)(!member=*)" -limit 0 -attr groupType sAMAccountName distinguishedName

Ver cuando se creo un grupo y a que grupos pertenece
dsquery * -filter "&(objectCategory=group)" -limit 0 -attr whenCreated samaccountname memberof

Ver la fecha de expiracion de los usuarios de una OU
dsquery user "OU=XXX,DC=test,DC=com" dsget user -dn -acctexpires

miércoles, 14 de abril de 2010

Operadores Powershell

-lt
Less than

-le
Less than or equal to

-gt
Greater than

-ge
Greater than or equal to

-eq
Equal to. If the left hand side of the operator is an array and the right hand side is a scalar, the equivalent values of the left hand side will be returned

-ne
Not Equal to. If the left hand side of the operator is an array and the right hand side is a scalar, the not equivalent values of the left hand side will be returned

-contains
Determine elements in a group, this always returns Boolean $True or $False.

-notcontains
Determine excluded elements in a group, this always returns Boolean $True or $False.

-like
Like - uses wildcards for pattern matching

-notlike
Not Like - uses wildcards for pattern matching

-match
Match - uses regular expressions for pattern matching

-notmatch
Not Match - uses regular expressions for pattern matching

-band
Bitwise AND

-bor
Bitwise OR

-is
Is of Type

-isnot
Is not of Type



These operators are the case-sensitive counterparts:


Operator
Definition

-clt
Less than (case sensitive)

-cle
Less than or equal to (case sensitive)

-cgt
Greater than (case sensitive)

-cge
Greater than or equal to (case sensitive)

-ceq
Equal to (case sensitive)

-cne
Not Equal to (case sensitive)

-clike
Like (case sensitive)

-cnotlike
Not Like (case sensitive)

-ccontains
left hand side contains right hand side in a case sensitive manner

-cnotcontains
determine excluded elements in a group in a case sensitive manner

-cmatch
Match (case sensitive)

-cnotmatch
Not Match (case sensitive)



Other operators: Operator
Definition

+
Add

-
Subtract

*
Multiply

/
Divide

%
Modulo

-not
logical not

!
logical not

-band
binary and

-bor
binary or

-bnot
binary not

-replace
Replace (e.g. "abcde" –replace "b","B") (case insensitive)

-ireplace
Case-insensitive replace (e.g. "abcde" –ireplace "B","3")

-creplace
Case-sensitive replace (e.g. "abcde" –creplace "B","3")

-and
AND (e.g. ($a -ge 5 -AND $a -le 15) )

-or
OR (e.g. ($a –eq "A" –OR $a –eq "B") )

-is
IS type (e.g. $a -is [int] )

-isnot
IS not type (e.g. $a -isnot [int] )

-as
convert to type (e.g. 1 -as [string] treats 1 as a string )

..
Range operator (e.g. foreach ($i in 1..10) {$i } )

&
call operator (e.g. $a = "Get-ChildItem" &$a executes Get-ChildItem)

. (dot followed by a space)
call operator (e.g. $a = "Get-ChildItem" . $a executes Get-ChildItem in the current scope)

-F
Format operator (e.g. foreach ($p in Get-Process) { "{0,-15} has {1,6} handles" –F $p.processname,$p.Handlecount } )



-eq Equal to (case insensitive)
-ieq Equal to (case insensitive)
-ceq Equal to (case sensitive)
-ne Not equal to (case insensitive)
-ine Not equal to (case insensitive)
-cne Not equal to (case sensitive)
-gt Greater than (case insensitive)
-igt Greater than (case insensitive)
-cgt Greater than (case sensitive)
-ge Greater than or equal to (case insensitive)
-ige Greater than or equal to (case insensitive)
-cge Greater than or equal to (case sensitive)
-lt Less than (case insensitive)
-ilt Less than (case insensitive)
-clt Less than (case sensitive)
-le Less than or equal to (case insensitive)
-ile Less than or equal to (case insensitive)
-cle Less than or equal to (case sensitive)


-contains Group of values in left hand operand contains value specified in right hand operand (case insensitive)
-icontains Group of values in left hand operand contains value specified in right hand operand (case insensitive)
-ccontains Group of values in left hand operand contains value specified in right hand operand (case sensitive)
-notcontains Group of values in left hand operand does not contain value specified in right hand operand (case insensitive)
-inotcontains Group of values in left hand operand does not contain value specified in right hand operand (case insensitive)
-cnotcontains Group of values in left hand operand does not contain value specified in right hand operand (case sensitive)

Calculo de consumos PC

Una pagina muy interesante donde especificar los componentes que tiene un ordenador y calcular el consumo, la fuente que necesita o el SAI adecuado.