Posts

Switch between PCs with multiple monitors and a simple KVM

Image
Background I have 2 PCs and 2 displays, and a modest KVM - which only supports a single screen. Problem Switching is cumbersome Switching between the PCs used to involve: Switching the KVM, which took care of one display Using the controls on the 2nd display to switch it to a different input One display's resolution and refresh rate is limited by KVM While my displays both support  a high resolution and refresh rate, the one connected via KVM was not able to utilize these capabilities. Solution Use the NirSoft freeware ControlMyMonitor Create a batch file to switch screens (one on each PC) Use a shortcut on the Windows taskbar Assign a keyboard shortcut (e.g. CTRL+Alt+0) You can switch by: CTRL+Alt+0 plus whatever switches your KVM (which still switches the mouse and keyboard) How to I created a batch file on each PC and saved it next to controlMyMonitor.exe, which I placed under program files. Here is the contents of the batch files:   On PC1:

Hyper-V: simplify moving between physical networks with teaming

Image
Situation You use Hyper-V on a laptop, which you connect via different physical connections, switching between e.g. WiFi, and LAN. You wish to use a Bridged connection on a VM. Problem When A Hyper-V VM network adapter is configured for bridging, it is bound to a specific physical Nic. If that adapter goes off-line (as is the case when you switch between WiFi and LAN), you need to manually connect the VM to a different, available Nic. Solution add multiple Nics to the VM Configure each to be connected to a different physical Nic Ensure you check "Enable this network adapter to be part of a team" under Advanced settings for each Nic Implement a Bridge in the VM (use Server Manager) pro tip: assign any static IP etc. to the bridge, restart to bind services to the new Nic\IP Make some coffee, you earned it.

Google Chrome: delete old versions

Free up disk space by deleting unused Google Chrome version history For OS-X | For Windows Note: you may need to show hidden files. use CMD + Shift + . (period) Use finder to open / Applications Right-click Google Chrom e --> Show package contents Go to Contents Under Versions you can delete anything that is not the latest version Sort by date and delete all but the latest version OR Start Google Chrome and use Chrome --> About Google Chrome to find your current version, then proceed to delete all others Under Frameworks --> Google Chrome Framework.framework --> Versions you can use the " Current " alias to locate the current version - you can delete everything else.

Mac OS: Log-foo

TL;DR Display all events since last boot In Terminal: sudo log show --boot --debug | more Display all Kernel events from the last 10 minutes In Terminal: sudo log show --predicate "processID=0" --start "$(date -v-10M "+%Y-%m-%d% %H:%M:%S")" --debug  processid=0 means kernel $date -v-10M means 10 minutes ago

Ansible and aws: adding hosts to known_hosts

Background Ansible uses SSH to control hosts. SSH (by default) expects the user to verify the identity of a server upon initially connecting to it. When connecting to a host for the 1st time, you will be prompted: Are you sure you want to continue connecting (yes/no/[fingerprint])? If you type yes in the above dialog, the host's public key and DNS name are added to a file called known_hosts The problem is that in many cloud environments, the DNS name for an instance is modified at each boot. Ansible, being reliant on SSH to connect to hosts, will fail if the host is not already in the known_hosts file, instead prompting the user to add the host to known_hosts. There are a few ways to solve this. You can instruct ansible to not verify the server's identity - but that defeats the ability of this mechanism to protect you fro
Get the IP of a hostname using WMI (vbscript) Purpose find the current IP of a given hostname approach: use the wmi win32_pingstatus to issue a ping, and get value of the returnaddress property sample code strTargethost = "server1.domain.com" Set objWMIService = GetObject("winmgmts:\\") Set PingResults = objWMIService.execquery("Select StatusCode,Address,ProtocolAddress FROM Win32_PingStatus where address = '" & strtargethost & "'") For Each oTarget In PingResults if oTarget.Statuscode   = 0 then  wscript.Echo "Host:" & strTargethost & ", address:" & oTarget.ProtocolAddress else wscript.echo "Host:" & strTargethost & ",status: " & oTarget.Statuscode end if Next

Refresh Group Membership for users immediatly

Normally, when you change a user's group membership in A/D, the change is only reflected once: the user logs off and back on OR the user's token expires - this happens after 8 hours by default Follow this procedure to force a refresh: (source: E-how article ) start LDP connect to each of your DCs bind with an administrative account from the browse menu, select  Modify in the Attribute  window, paste this:  updatecachedmemberships click add check the  Extend  checkbox click Run While I tested this today, I thing I got mixed results. can anyone confim this really works ?