Scripts

PSSCRIPTS

A collection of various Powershell script

Wait-Object Powershell Function

#Requires -Version 3.0 <# .SYNOPSIS Pauses execution until scriptblock returns expected object. .DESCRIPTION The command will wait for a specific object to be returned from a scriptblock. If the object is returned the command will return the object and the script will continue execution but if the object is not returned before the timeout then an error record is returned and continuation of the script depends on ErrorAction Preference .PARAMETER InputObject The Object that is expected to be returned from the scriptblock.

Credential IO Script

This is an updated version of the Import and Export Credential functions that store the creds in a json format versus the clixml format used by the original created by the guys @ powertips & powershell.com. I also store them in a known location and I use a string for a look up key to store and retrieve them. This allows me to use EFS to further secure the files on the drive.

Save HTML as DOCX

the other day we had a need to save an HTML file as DOCX. We are creating the HTML file using ConvertT0-HTML. The file contains data that needs to be saved in SharePoint and needs to be editable by others. We decided to save as a DOCX because those in management all have WORD installed but don’t have a  Dedicated HTML editor. So here is the Code Enjoy. !!! YOU MUST HAVE WORD 2007 or 2010 INSTALLED !