Exposing a stream around a log file for synchronous writes using Powershell

I was recently looking at streaming output to a log file synchronously in a powershell session to write numerous events for invoking several cmdlets in a script operation. In order to achieve this I was able to leverage the FileStream and StreamWriter classes as well as creating a log function to both write the event … More Exposing a stream around a log file for synchronous writes using Powershell

Modifying guest network interface with the Invoke-VMScript cmdlet

With the news that the ‘Set-VMGuestNetworkInterface’ cmdlet is to be deprecated in the next release of PowerCLI (http://blogs.vmware.com/PowerCLI/2014/11/announcement-future-cmdlet-deprecation.html), the question is how do I now modify the guest network interface? The ability to perform this action can now be moved to the Invoke-VMScript cmdlet, which is a pretty cool way to invoke a script in … More Modifying guest network interface with the Invoke-VMScript cmdlet

Encoding image files into a base64 string using Powershell

I was recently looking at encoding image files into a Base64 string to place directly into HTML and CSS, whilst there is a number of useful online tools to complete this task, I decided to have a look at performing this task using Windows Powershell. This can be achieved by using the [convert]::ToBase64String method and is … More Encoding image files into a base64 string using Powershell

Powershell: Securing credentials using the PSCredential class

This a pretty old one but a script block at times I revert back to in particular when there is a requirement to specify user credentials in order to complete a task. When requiring to store credentials in a script block, these should not be entered in plain text from a security perspective and can … More Powershell: Securing credentials using the PSCredential class