Word to PDF Batch Conversion

I needed to convert a bunch of Word files to pdf. I found this visual basic code that basically opens all files one after another in Word and saves a pdf version.

'Convert .doc or .docx to .pdf files via Send To menu
Set fso = CreateObject("Scripting.FileSystemObject")
For i= 0 To WScript.Arguments.Count -1
   docPath = WScript.Arguments(i)
   docPath = fso.GetAbsolutePathName(docPath)
   If LCase(Right(docPath, 4)) = ".doc" Or LCase(Right(docPath, 5)) = ".docx" Then
      Set objWord = CreateObject("Word.Application")
      pdfPath = fso.GetParentFolderName(docPath) & "\" & _
	fso.GetBaseName(docpath) & ".pdf"
      objWord.Visible = False
      Set objDoc = objWord.documents.open(docPath)
      objDoc.saveas pdfPath, 17
   End If   
vbs file

Just save it as a vbs somewhere and add a ahortcut to the context menu.

Context Menu Entry

You can select multiple files at once and they get converted one by one.

Running Powershell Scripts with Shortcuts and Administrator Priviliges

If you want to elevate a powershell to execute a script with admininstrator priviliges, I found this code snippet useful. Used as the first line in your script, it elevates the powershell and triggers a UAC prompt. The rest of the script then gets passed on to the elevated powershell instance.

if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File "$PSCommandPath"" -Verb RunAs; exit }

To run a powershell script with a double click, like with a .bat file, I created a shortcut with these arguments.

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Users\USERNAME\Documents\ps_scripts\SCRIPTNAME.ps1

This saves me from right clicking and clicking again on the context menu entry for running the script in powershell.

Debloat Windows 10 (and stop MS from spying)

Through the YouTube channel and website of Chris Titus I found this freeware tool to debloat Windows l0. Basically, you just run this command in an elevated Powershell:

iex ((New-Object System.Net.WebClient).DownloadString('https://git.io/debloat'))

This will load the tool and open it in a separate window. The tool itself can be loaded from it’s GitHub page, where additional information is available. Windows 10 Debloater is free software licensed under the MIT License (Copyright (c) 2017 Richard Newton)

There is also another freeware tool by O&O Software, O&O ShutUp10, which you can use additionally to debloat Windows 10. It has got some nice toggle switches and predefined recommended settings. Custom preferences can be saved to a file. Additionally, after an Update, ShutUp10 can check if anything got changed back by windows update and correct this.

Here are the links to Chris Titus’ website with additional information worth a read:



Make Windows cmd more useful: command line editing and auto completion with clink

Like every other admin, I sometimes have to use the command line in Windows. The feature I missed the most (from using macOS) in cmd.exe is the automatic completion of commands and filenames with tab.

After some digging I found the perfect tool: clink.

Continue reading “Make Windows cmd more useful: command line editing and auto completion with clink”

Easy Way of Disabling Webcams and other devices in Windows

I don’t put tape over my webcams, neither on my MacBooks, iOS Devices nor on my Windows machines. I refuse to be like that. If someone was honestly suspecting a malicious attacker would spy on them using their webcam, then I would argue that these people, if they were consistent, would also need to rip out the microphones of their devices.
On the other hand, I’m not that naive to think that there is no risk involved using such input devices.

Continue reading “Easy Way of Disabling Webcams and other devices in Windows”