Tag Archives: PowerShell

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

Lync, Exchange, and Active Directory Photos

Recent versions of Microsoft Lync and Exchange support a centralized photo capability so that all users in the organization see the same photo for colleagues hosted on the same Exchange/Lync/Active Directory (AD) infrastructure. This new feature is still evolving and … Continue reading

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

Concatenate CSV Files with PowerShell

For us Unix/Linux folks, the classic “cat” command is a beautiful way to combine text files together. Because of this popular Unix command, Microsoft ships PowerShell with a default alias cat which maps to their Get-Content command. Unfortunately, the similarities … Continue reading

Posted in System Administration | Tagged | Leave a comment

PowerShell for OpenSSL CA Issued Cert Status

In the lab you might use a basic OpenSSL certificate authority (CA) to issue test client certificates. If you’re on Windows, you may find the following PowerShell sample helpful to list the issued client certs along with current status, subject, … Continue reading

Posted in System Administration | Tagged , | 1 Comment