Thursday, April 30, 2020

Check For Admin Rights with PowerShell

Recently I was trying to determine if a domain user is a local Administrator of their workstation and found many options... Note that there is a difference in checking if the user is a local Administrator and checking if the command is running in an elevated context. Here's what worked best for me...

Check if user is in local Administrators group:
$userIsAdmin = [bool](Get-LocalGroupMember Administrators | Where-Object name -Like "*$env:USERNAME")
This method seemed to fail on some workstations with domain trust issues. If the user showed up as it's SID in the local administrators group, the -like wouldn't match and thus this method wasn't consistent.

Instead of checking the local Administrators group for list of users, leveraging the com "whoami" appears to evaluate correctly in all testing.
$userIsAdmin = [bool](whoami /groups /fo csv | ConvertFrom-Csv | Where-Object SID -eq "S-1-5-32-544")

Check if running as Administrator:

If you're looking to check if your script is running as Administrator (aka, in an elevated context), I found these two options.
$runningAsAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups | Select-String 'S-1-5-32-544')
I'm preferring the below option even though it's a little bit longer.
$runningAsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")

Happy Scripting!
Justin

Friday, January 31, 2020

"Aw, Snap!" Chrome 79 within VMware App Volumes AppStack

Recently updated Google Chrome within my VMware App Volumes 2.18 environment (as part of a standard apps AppStack) to Chrome version 79 and "Aw, Snap!" nothing worked... No pages would load successfully, presenting me with the very generic "Aw, Snap!" crash page.
Through some Google'ing, found that Google has re-enabled a "Code Integrity Checking" feature causing lots of users to experience this problem due to incompatibilities with some security software packages.
The quick and easy test is to add the following command to the end of Chrome's shortcut target and test:
--disable-features=RendererCodeIntegrity
Ta da! Chrome now worked! Instead of modifying the Chrome shortcuts within my AppStack, I decided it would be better to apply this setting via Group Policy. Not only to ensure the setting is applied no matter how Chrome was launched, but also to be able to easily remove the disabling-of this Chrome security feature if and when the incompatibility with App Volumes is resolved <fingers crossed>. Chrome's Renderer Code Integrity can be disabled via Computer Configuration or User Configuration > Policies > Administrative Templates > Google > Google Chrome > Enable Renderer Code Integrity = Disabled
Happy Stacking!
Justin

Friday, December 30, 2016

Backup your DVD and Blu-ray Libraries with HandBrake on Windows

I've been using Plex for several years now and love it! If you haven't heard of Plex, you must go check it out (https://www.plex.tv/) as it basically allows you to create your own personal Netflix with all your own content. However, my biggest issue with Plex was not having an easy way to "backup" my physical DVD/Blu-ray library for use in Plex... A hurdle I only recently overcame. In my research I never found an article/tutorial/walk-through that fully covered the use of Handbrake on Windows for both DVD and Blu-ray. Thus the reason I thought this would be an excellent walk-through to share. I believe the following process can also be done on Mac and Linux, but my instructions are assuming you're running 64-bit Windows 7, 8.1, or 10. So here goes...

1) Download and Install HandBrake
Download HandBrake from https://handbrake.fr/downloads.php and install.
HandBrake will be the utility used to create the "backups" of your physical DVD and Blu-ray library. HandBrake is an open source application that can transcode (convert) almost any video file into a more openly supported file, using "a selection of modern, widely supported codecs." -excerpt from https://handbrake.fr/. I've used a few different transcoder apps, but HandBrake has been my favorite by far.  HandBrake on it's own cannot "backup" a DVD or Blu-ray.
2) Download and setup VideoLAN's libdvdcss
Download libdvdcss from http://download.videolan.org/pub/libdvdcss/1.2.12/win64/libdvdcss-2.dll and copy "libdvdcss-2.dll" to C:\Program Files\Handbrake\ (HandBrake default installation directory).
VideoLAN's libdvdcss is an open source software library that has the ability to decyrpt DVDs encrypted with the Content Scramble System (CSS). At the time of writing, version 1.2.12 was the newest version available for Windows. Placing "libdvdcss-2.dll" in HandBrake's installation directory, allows HandBrake to decrypt the DVD's CSS on the fly. At this point, you can now skip down to step 5 to create the "backup" of your physical DVDs. If you have a Blu-ray drive, continue on to add support for Blu-rays as-well.
3) Download and Install MakeMKV
Download MakeMKV from http://www.makemkv.com/download/ and install. Use the monthly beta key made available here https://www.makemkv.com/forum2/viewtopic.php?f=5&t=1053 to register the beta software.
MakeMKV is another transcoder application (like HandBrake) but has the ability to "backup" Blu-rays. Please note that MakeMKV is a beta application and currently includes a 30-day trial when installed. If you like the application, I would recommend purchasing a license, but monthly updated beta keys are made available on the forums (see link above) which can be used to keep the free beta application registered. At this point, you could use MakeMKV to "backup" a Blu-ray into an undegraded MKV file (mine have been around 40GB in size) and then use HandBrake to re-encode that MKV into a new smaller file, but then we're doing two encode processes which each takes time. Continue on to give HandBrake the ability to use MakeMKV on the fly.
4) Enable MakeMKV's Blu-ray support in HandBrake
Open a Windows CMD prompt as Administrator and run the following commands:
cd "\Program Files\Handbrake"
mklink libaacs.dll "C:\Program Files (x86)\MakeMKV\libmmbd64.dll"
mklink libbdplus.dll "C:\Program Files (x86)\MakeMKV\libmmbd64.dll"
The first command above changes the working directory to HandBrake's default installation directory on 64bit Windows. The second and third commands create a symbolic link to MakeMKV's "libmmdb.dll" file in HandBrake's installation directory. This allows HandBrake to "backup" Blu-rays just as MakeMKV is able to on it's own. Even though MakeMKV also has the ability to decrypt DVDs, I've found that VideoLAN's libdvdcss seems to work on more DVDs than MakeMKV.
5) Backup DVD or Blu-ray with HandBrake
- Launch HandBrake
- Insert DVD/Blu-ray media
- Click "Open Source"
- Click DVD/Blu-ray drive > HandBrake scans the disc for all available titles
- In the "Presets" pane on the right, scroll down to the section titled "Matroska" and click "H.264 MKV 480p30" (I just prefer MKV. Also, this would be a good time to right click "H.264 MKV 480p30" and click "Set Default" so this is the option HandBrake uses by default moving forward. Note that the 480p30 option is similar to DVD quality. If backing up a Blu-ray, you can optionally choose the "H.264 MKV 720p30" or even the "H.264 MKV 1080p30" option if you want a higher quality file; of-course the file size will be much larger and require more bandwidth for the stream.)
- The dropdowns under "Source" are almost always set perfectly by default. Every once in a while you may have to change the "Title" on discs with multiple versions of the movie (full screen and wide screen for example) or the start and end chapters (some DVDs have the first chapter of the movie as trailers for other movies).
- Under "Destination," click the "Browse" button to tell HandBrake where to save the file and it's name. See Plex's naming standards for Movies and TV Shows. I recommend saving the file to a temp location and testing the video file before moving it to your Plex library directory.
- Once all the output settings are to your liking, click "Start Encode"
- Once complete, test the video file.
- Copy video file to Plex library directory.

Sunday, November 4, 2012

JahnsTek is now a Dell Registered Partner!



JahnsTek, LLC is excited to announce that we're now a Registered Partner in the Dell PartnerDirect Program. Investing the time and resources to gain this prestigious Partner status enables us to be an even more valuable, strategic partner for you.

The benefits of being a Dell Registered Partner are numerous, and the exclusive knowledge and best-practices information we have gained better position us to deliver the best solutions for your needs.

Our Dell Registered Partner status:

  • Provides you with access to Dell's award-winning products and solutions
  • Enables us to offer you flexible financing programs
  • Allows us to align with a leader in "Green IT" and offer you energy-efficient products 
  • Can help your business run faster, better and smarter

Please feel free to contact us to learn more about Dell's cutting-edge products and solutions, and how they can benefit your business.

We look forward to doing business with you.

Justin Jahns
JahnsTek, LLC

Monday, September 12, 2011

Launch IE Window at Windows Login Prompt

If your in need to launch an Internet Explorer window (or pretty much any process) at the Windows login prompt (before any user logs in) here's a solution that I've helped implement and it's working great.

On Windows XP
Displaying an IE window at the login prompt in Windows XP is relatively easy. A simple VBscript run as a startup script is all that is needed.

Set objExplorer = CreateObject("InternetExplorer.Application")
Set WshShell = Wscript.CreateObject("WScript.Shell")
objExplorer.Navigate "http://yourintranetsite.com/"
objExplorer.Visible = true
objExplorer.ToolBar = false
objExplorer.MenuBar = false
objExplorer.StatusBar = false
objExplorer.AddressBar = false
objExplorer.Width = 340
objExplorer.Height = 560
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Resizable = false
Wshshell.AppActivate ("Welcome to Windows")

The above VBscript will open an IE window, remove the toolbar, menu bar, status bar, and address bar, set the size of the window, and position it in the top left corner of the screen. The final line of the script, switches the "active window" back to the login prompt so that users are able to start typing without having to click in the username box. This script can be easily set to run on startup using Group Policy (Computer Configuration > Policies > Windows Settings > Scripts > Startup). For computers not in a domain, local group policy can be used to set this script as a startup item (see http://support.microsoft.com/kb/307882).

On Windows 7
Starting with Windows Vista, Microsoft has implemented the use of different user sessions in order to increase security, and this makes it a bit more difficult to launch an IE session at the login screen. Thus if you used the same process as explained above for Windows XP, the script would run, launching the IE window, but you wouldn't be able to see it because it would be running in the wrong user session. Through some research and a little luck I found that the SysInternal's tool, PsExec.exe (which I've used for years), provides a "-x" parameter that "displays the UI on the winlogon desktop." Again, as simple VBscript is used to launch the IE window in Windows 7, but the VBscript needs to be run by PsExec.exe with the "-x" parameter to make the IE window visible at the login screen.

Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "http://yourintranetsite.com/"
objExplorer.Visible = true
objExplorer.ToolBar = false
objExplorer.MenuBar = false
objExplorer.StatusBar = false
objExplorer.AddressBar = false
objExplorer.Width = 340
objExplorer.Height = 560
objExplorer.Left = 0
objExplorer.Top = 0

The above VBscript is the same as the XP script, minus the two lines specific for XP. In a domain environment, this can be easily set to run on startup using Group Policy (Computer Configuration > Policies > Windows Settings > Scripts > Startup) but instead of specifying the VBscript to be run, specify PsExec.exe to be run with the following parameters:
-x cscript.exe //nologo "\\<domain>\sysvol\<domain>\Policies\<policyguid>\Machine\Scripts\Startup\<scriptname>.vbs"
Note that the VBscript and the PsExec.exe files must be present in the correct directory for the GPO your using to apply this startup item. By default PsExec.exe requests for it's EULA to be accepted before it runs, which you would not want to pop up when applying this via GP to tens, hundreds, thousands of machines; so the solution to this is to apply the following registry value:
"HKEY_USERS\.DEFAULT\Software\Sysinternals\PsExec\EulaAccepted" set to "1"
This eliminates PsExec's EULA prompt on startup. For computers not in a domain, local group policy can be used in a similar fashion to launch the IE window on startup (see http://technet.microsoft.com/en-us/library/cc731745.aspx).

Hopefully this information comes in handy for someone...
Justin

Monday, April 4, 2011

Switch from ATA to AHCI in Windows 7

I've been upgrading quite a few machines from Windows XP to Windows 7 lately, and for some reason, almost every time, I forget to change the SATA Operation setting in the BIOS from ATA to AHCI after wiping the drive and before installing Windows 7.
AHCI (Advanced Host Controller Interface) is a new interface specification that allows the SATA controller driver to support advanced features that can give better performance out of SATA hard drives, especially in Windows Vista/7.
After two or three times of restarting the Windows 7 installation process after changing the SATA Operation to AHCI in the BIOS, I thought their must be a way to make this change without having to reinstall Windows. After a little digging, I found out their is a simple registry change that can be made that will allow for the SATA Operation change. Here's what you can do:
  1. Start "regedit.exe"
  2. Browse to HKLM\System\CurrentControlSet\Services\msahci\
  3. Change the DWord value named "Start" from "3" (ATA) to "0" (AHCI)
  4. Shutdown the computer
  5. Power the computer back on, making sure to enter the BIOS and change the SATA Operation to AHCI
  6. Save the change

Justin


Warning: Changes made to the Windows registry happen immediately, and no backup is automatically made. Do not edit the Windows registry unless you are confident about doing so. Creating a backup before editing the registry is highly recommended.

Sunday, September 26, 2010

Office 2007 Spell Check Not Working

Even though Office 2010 has since been released I recently upgraded a client's workstation from Microsoft's Office 2003 to Office 2007. The upgrade installed without a hitch, including the service pack 2 update, but after a few days the client noticed the Spell Check feature of Word, Excel, Powerpoint, and even Outlook was not working.
Through a little google'ing I found several articles mentioning a specific Registry entry that was the culprit. These articles and forum posts where saying to delete an entire key from the HKCU registry hive. Interestingly enough, I delete this key and the spell check feature still doesn't work. To make a long story short, I found that the entire key cannot be deleted, but rather only two values within the key. So here is the fix that worked for me:
  • Click "Start" > "Run" > "regedit" > click "OK"
  • Browse to: HKCU\Software\Microsoft\Shared Tools\Proofing Tools\1.0\Override\en-US
  • Delete the "DLL" and "LEX" values pointing to non-existing files
  • Restart any open Office applications

You can also merge the following .REG file, which will also delete the two above mentioned values:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Shared Tools\Proofing Tools\1.0\Override\en-US]
"DLL"=-
"LEX"=-


I hope this post saves you several hours of troubleshooting this specific issue. Feel free to post any comments.
Justin