jueves, 5 de mayo de 2016

Run script As user (Useful when running scripts with encrypted credentials) | Ejecutar script como otro usuario (útil cuando el script tiene credenciales encriptadas)


Sometimes you need to store username and password on your scripts and if you are sharing them with other members of your team you should use a common account to encrypt the values, in my case we run scripts manually or by using PDQ Deploy (Admin Arsenal) running on a service account, encrypting credentials mean that if someone has physical access to the scripts they will not have the credentials to execute it unless they get access to the credentials used to encrypt them.

$Credentials = (Get-Credential)
$ScriptToExecute = {return (
Get-Item Env:AppData)}
$AppData =
Invoke-Command -ComputerName localhost -Credential $Credentials -ScriptBlock $ScriptToExecute
$AppData # Now contains the Environment var named "AppData"

Thank you Mathias for sharing this quick and easy way to do this:



martes, 3 de diciembre de 2013

Print server properties (Useful when dealing with printer drivers in a Terminal Services environment) | Propiedades de impresoras, muy util cuando hay que instalar controladores en Terminal Services

I found this very useful every time I have to deal with drivers in Terminal Servers, the most common scenario is for HP Printers that need a specific PCL driver to work properly, the Easy Print Driver is great because it offers compatibility with most printers but not all features are available and customers want to have the same level of functionality and user experience in RDS that they have when using their local computer (Just remember to modify the GPO to not use Easy Print as the first option, more to come on this)


 




You can get the full list of switches by executing: | La lista completa de modificadores la encuentras ejecutando el siguiente comando 

printui /?

miércoles, 6 de noviembre de 2013

Reduce Timeouts by enabling Keep Alive Heart Beat (RDS-RDP) / Keep Alive heart beat reduce las desconexiones por timeout en sesiones the RDS-RDP

HKEY_LOCAL_MACHINE\ SYSTEM\CurrentControlSet\Control\Terminal Server and created with a Value of 1 (DWORD 32bit)

If your TS environment is accessed by remote users connecting from the Internet, specially from high latency WAN connections like cellular data and satellite, is a good idea to turn on "Keep-alives"on your server.  This will help prevent users from being disconnected due to inactivity timeouts on routers.

To do this:


  1. Start--Run--gpedit.msc
  2. In the left pane, navigate to Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Session Host\Connections
  3. In the right pane, double-click Configure keep-alive connection interval (I used 1 as the value)
  4. Select Enabled, then click OK
  5. Apply the gpupdate /force or Restart the server for the change to take effect


This not always helps as Bryan Q (a colleague)  found that for some reason not all keepalives reach their destination in our environment, still we noticed considerable improvement in disconnects, most likely the missing packets are related to network issues, still I will investigate a little more and share my findings.