Tag Archives: PowerShell

View Certificates Issued to Hostname in ADCS

Active Directory Certificate Services (ADCS) is a useful service to provide in a Windows Domain environment. If you’re managing ADCS, you might want a quick way to list issued certificates to a specific hostname. Here’s a quick PowerShell script that … Continue reading

Posted in System Administration | Tagged , , , | Leave a comment

Clear adminCount and Enable Inheritance on User

Users in Active Directory that belong to factory default privileged groups will be protected by an hourly process called SDProp (Security Descriptor Propagator) on the Primary Domain Controller (PDC Emulator). This process sets the adminCount attribute to 1 and disables … Continue reading

Posted in System Administration | Tagged , , | Leave a comment

View Server Certificate with PowerShell

This is a follow-up to my previous post on checking Server Certificate detail with OpenSSL. Note that this example lacks error checking – that is left as an exercise for the reader. This is based on the “Parallel Universe” blog … Continue reading

Posted in System Administration | Tagged , , | Leave a comment

Set Windows Firewall Zone to Domain

The Windows native host-based firewall is zone-based. This would be fine if you could set the zone for a given interface, but Microsoft has designed it to automatically determine the zone for a network interface using their Network Location Awareness … Continue reading

Posted in System Administration | Tagged , , | Leave a comment

PowerShell Foreach-Object Modify Pipeline Objects

You can modify pipeline objects on-the-fly using Foreach-Object. The syntax is a little strange because you need to put the object back on the pipeline if desired for additional processing. WordPress.com code-sanitization is eating my $_ so trying Gist, BLAH. … Continue reading

Posted in System Administration | Tagged | Leave a comment

SharePoint API Invoke-RestMethod PowerShell

Invoke-RestMethod was introduced in PowerShell 3.0, but unfortunately there is a bug that prevents the user from setting the “Accept” header. The SharePoint 2013 REST API requires special values applied to the Accept header to return common items like list … Continue reading

Posted in System Administration | Tagged , , | Leave a comment

Grep for Windows PowerShell

I recently needed to search a file in Windows for matching lines of text and did some looking around for a built-in tool to accomplish the task. I had some unique requirements that led me to a useful solution with … Continue reading

Posted in System Administration | Tagged , , | Leave a comment

Task Scheduler PowerShell Script Log File

This is a continuation to my earlier posts PowerShell Error Log File and Export and Email … Using Powershell. This is also a test of the WP.com Gist code snippet support. The following script sample is intended to provide ideas … Continue reading

Posted in System Administration | Tagged , , , | 1 Comment

PowerShell Error Log File

PowerShell is great for scheduling administrative tasks, but it can be difficult to figure out a reliable way to log the error output if things go wrong. The Windows task scheduler will record last run result of 0x1 (error), but … Continue reading

Posted in System Administration | Tagged , , | 3 Comments

PowerShell One Folder per Week

I have the need to run a daily script job and log the results in a separate file for each week. There are two problems that I need to resolve to completely automate this task. (1) I need to figure … Continue reading

Posted in System Administration | Tagged | Leave a comment