This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cargamos modulo | |
Add-PSSnapin Citrix.Broker.Admin.V2 | |
#Obtenemos las sesiones | |
$sesiones=Get-BrokerSession | Select-Object Username | Set-Content C:\Scripts\Usuario.txt | |
# Limpiamos los espacios en blanco | |
(gc C:\Scripts\Usuario.txt) | ? {$_.trim() -ne "" } | Set-Content C:\Scripts\Usuario.txt | |
(gc C:\Scripts\Usuario.txt) -replace ("@{UserName=", "") -replace ("}", "") | Set-Content C:\Scripts\Usuario.txt | |
(gc C:\Scripts\Usuario.txt) | ? {$_.trim() -ne "" } | Set-Content C:\Scripts\Usuario.txt | |
$Existe=(gc C:\Scripts\Usuario.txt) | |
#Cerramos todas las sesiones de los usuarios detectadas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script Raúl Unzué - El Blog de Negu | |
# Buscamos modificar un valor en una clave de registro | |
# relacionando directorio activo con otra base de datos | |
# SABER EL USUARIO | |
$usuario=C:\windows\system32\whoami.exe | |
# ELIMINAR DOMINIO | |
$usuariomodificado=$usuario.Substring(5) | |
# SABER SID DE LISTADO | |
# BUSCAMOS USUARIO EN DA | |
(Get-Content "\\SYNOLOGY\SCRIPTS\usuarios-active-directory.txt") | Select-String -Pattern $usuariomodificado | Set-Content "\\SYNOLOGY\SCRIPTS\sid-$usuariomodificado.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RAUL UNZUE - ELBLOGDENEGU | |
# https://www.maquinasvirtuales.eu/powershell-script-para-matar-procesos-windows-enlazados/ | |
# Revisar si existen en el sistema dos procesos java.exe y acslaunch_win-32 | |
# SABER EL USUARIO | |
$usuario=C:\windows\system32\whoami.exe | |
# ELIMINAR DOMINIO | |
$usuariomodificado=$usuario.Substring(5) | |
# EXTRAER USUARIO, SESION ID Y PROCESOS ASOCIADOS AL USUARIO | |
Get-Process -IncludeUserName | Select-Object Username,SessionID | Where-Object { $_.UserName -ne $null -and $_.UserName.Equals("NEGU\$usuariomodificado") } | |
Get-Process -IncludeUserName | Select-Object UserName,SessionId,ProcessName | Where-Object { $_.UserName -ne $null -and $_.UserName.Equals("NEGU\$usuariomodificado") } | Set-Content C:\Users\$usuariomodificado\Desktop\proceso1.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ejemplo Job Simple | |
apiVersion: batch/v1 | |
kind: Job | |
metadata: | |
name: ebdn-cuenta | |
spec: | |
template: | |
metadata: | |
name: ebdn-cuenta | |
spec: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Este script cierra todas las sesiones RDS | |
$fecha = get-date -format yyyy-MM-dd_HH-mm | |
$log_file = "C:\scripts\logs\Cierre_Sesiones-$fecha.txt" | |
# Cargamos las sesiones del servidor, tanto activas como desconectadas | |
$sesiones = Get-RDUserSession | |
foreach ($sesion in $sesiones) | |
{ | |
# Mata el número de sesión ID en el servidor en el que se encuentre la sesión actual del bucle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cargamos modulo | |
Add-PSSnapin Citrix.Broker.Admin.V2 | |
# Obtenemos las sesiones | |
(Get-BrokerSession | Select-Object -Property BrokeringUserName | Format-Wide -Column 1 | Out-String) | Set-Content C:\Scripts\Usuario.txt | |
# Limpiamos los espacios en blanco | |
(gc C:\Scripts\Usuarios.txt) | ? {$_.trim() -ne "" } | Set-Content C:\Scripts\Usuarios.txt | |
$Existe=C:\Scripts\Usuarios.txt | |
#Cerramos todas las sesiones de los usuarios detectadas | |
If ($Existe -eq $True) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
###################################################### | |
# Zabbix-Telegram envio de alerta por Telegram | |
# Date: 01/05/2020 | |
# Script Raul Unzue - https://www.maquinasvirtuales.eu | |
###################################################### | |
MAIN_DIRECTORY="/usr/local/share/zabbix/alertscripts" | |
# To enable the debug set here path of file, otherwise set /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-WMIObject -Class Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3} ` | |
| Select-Object @{n="Unidad";e={($_.Name)}}, | |
@{n="Etiqueta";e={($_.VolumeName)}}, | |
@{n='Tamaño (GB)';e={"{0:n2}" -f ($_.size/1gb)}}, | |
@{n='Libre (GB)';e={"{0:n2}" -f ($_.freespace/1gb)}}, | |
@{n='% Libre';e={"{0:n2}" -f ($_.freespace/$_.size*100)}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################### | |
####### RAUL UNZUE - ELBLOGDENEGU ######### | |
########################################### | |
########## Script cambio owner ############ | |
########################################### | |
# https://www.maquinasvirtuales.eu/script-powershell-para-cambiar-owner-carpetas-y-archivos/ | |
# EMPEZAMOS LOG: | |
Start-Transcript ("c:\temp\logs\OWNER-ScriptLog{0:yyyyMMdd-HHmm}.txt" -f (Get-Date)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script ElBlogdeNegu de Raúl Unzué | |
# Se recorre el escritorio de perfiles FSLogix y UPM buscando ficheros WS | |
# Si no hay ficheros WS genera un fichero en blanco | |
# https://www.maquinasvirtuales.eu/powershell-script-busqueda-de-ficheros-en-perfiles-citrix/ | |
# SABER EL USUARIO | |
$usuario=C:\windows\system32\whoami.exe | |
# ELIMINAR DOMINIO PARA LIMPIAR NOMBRE | |
$usuariomodificado=$usuario.Substring(8) |