Disabling the Scripting.FileSystemObject ComObject (When you get the 0x8002801c error)

UnRegister scrrun.dll Error
UnRegister scrrun.dll Error

When working with a customer to automate the hardening process (STIG: Security Technical Implementation Guide) for IIS servers, we ran into a problem (error 0x8002801c) when we tried to run the following command in order to disable (unregister) the Scripting.FileSystemObject ComObject C:\Windows\System32\regsvr32.exe /u scrrun.dll The 0x8002801c error translates to TYPE_E_REGISTRYACCESS. Using Sysinternal’s Process Monitor (aka…

1

Add permissions to a Session Configuration

Add permissions to a Session Configuration
Add permissions to a Session Configuration

Though the recommended approach would be to upgrade to PowerShell 5.1 and implement JEA (preferable with DSC and the JEA DSC module), there sometimes might be a need to programmatically add permissions to a PowerShell session configuration. Continuing the mentioned above, and a question asked on the reddit forum, below is an example on how…

0

Remove Profiles from a local or remote computer

Remove-Profile
Remove-Profile

A common need for a Remote Desktop Services (RDS) and/or Citrix farm admin, is to remove local profiles from a server. Another example for this, is the question posted a few days ago in the PowerShell.org forum here. Funny thing, about 6 years ago, I wrote a vbscript that does that. It just doesn’t filter…

0

Embed PowerShell code in a batch file

Embed PowerShell code in a batch file
Embed PowerShell code in a batch file

In a certain scenario, I needed a batch file (bat or cmd extension) that runs PowerShell code, and I could have only one file, so I couldn’t go with the easy way of a batch file calling PowerShell.exe with the -File parameter specifying the path to a ps1 file. For this, I created a special…

5

Passing down the WhatIf and Confirm preferences to other cmdlets from an Advanced Function

A colleague of mine was writing a cool function that tidies up the GPOs, and he wanted to implement the -WhatIf common cmdlet parameter in his function. There’s a simple way of doing that, just add the [cmdletBinding(SupportsShouldProcess)] and the param() blocks in the top of your function, add the if ($PSCmdlet.ShouldProcess($target)) {} in the…

1

Using VSCode and the PowerShell extension in an offline environment

The PowerShell ISE was first shipped with PowerShell 2.0 (November 2006), and greatly improved in PowerShell 3.0 (August 2012), with the PowerShell Tabs, the Show-Command Add-on and the snippets (CTRL+J). But since then, it pretty much stayed the same. Fast forward to May 2017, David Wilson from the PowerShell team announced (amongst other things) that:…

0