Using DSC with the WinRM service disabled

  Every once in a while I come across a weird scenario where the customer’s requirements and/or limitations are so challenging that they take me to a interesting discovery journey. This time, the requirement was to use Desired State Configuration (DSC) in remote machines where there was no connectivity (with any protocol or port) to…

0

Adding extended properties as NoteProperties

Continuing my post on Filtering files by their metadata (extended properties), and a question raised by Ankor in the comments section, I decided to quickly wrap up a new function (based on the one in the post) that simply adds the specified extended properties as new note properties to the object in the pipeline. As…

3

ConvertFrom-ISO8601Duration

ISO 8601 describes durations as a component of time intervals and define the amount of intervening time in a time interval. From Wikipedia (https://en.wikipedia.org/wiki/ISO_8601#Durations): Durations are represented by the format P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W as shown to the right. In these representations, the [n] is replaced by the value for each of the date and time…

0

Export-CACertificatesForDscEncryption

(Updated @ 2016/05/18) When you use Desired State Configuration (DSC) and a Pull server, you should encrypt any credentials in your configurations documents. More information on this here: https://blogs.msdn.microsoft.com/powershell/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration/But instead of harvesting the certificates from the remote computers themselves (as described in the blog post above), I decided to query the CA directly, and get…

0

Disable Invoke-Expression

There was an interesting discussion in one of our internal discussion groups about disabling Invoke-Expression, so I decided to roll up my sleeves and check if it can really be done.   First of all, what is Invoke-Expression? “The Invoke-Expression cmdlet evaluates or runs a specified string as a command and returns the results of…

2

Write to HKCU from the system account

In this scenario, I needed to be able to write to the currently logged on users’ HKCU registry, but from a process being run as local system. Afterwards I even had to write the HKCU for every user that will ever logon to the machine, and for every user that already logged-on before. The solution…

2

Copy files to an Azure VM through PSRemoting

You may sometimes need to copy a file to a remote machine where the SMB (aka cifs) ports are closed, or the option to copy files through the RDP connection is disabled as well. Also, you may need to copy the file(s) as a step in an automated process. If you have PowerShell 5.0 installed…

0

Update-Help for disconnected machines

PowerShell 3.0 and above do not contain any in-box help files, so when you run Get-Help it will display the auto-generated help syntax based on the cmdlet’s metadata (same as using Get-Command with the -Syntax switch) and will prompt you to use the Update-Help cmdlet to download the help files. As soon as the help…

0

Detect .NET Framework versions installed

This script will detect the various .NET Framework versions installed on the local or remote computer(s). It queries the registry for the information (Remote Registry is required for querying the remote computer), and lists the .NET Framework version and it’s build. The logic and version information are based on https://msdn.microsoft.com/en-us/library/hh925568 The script file is available…

2

Error 0xd00000bb installing WMF 4.0 on an RODC

  If you try to install KB2819745 (WMF 4.0) on a Windows 2008 R2 Read-Only Domain Controller (RODC), and after the server reboots the screen shows "Failure configuring Windows updates Reverting changes . Do not turn off your computer" It means there was an error during the installation at the reboot phase, so it’s rolled…

1