Tag Archives: PowerShell

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

Service Management with PowerShell

PowerShell is great for automating administrative tasks. Common tasks may include managing services (stop, start, restart, etc). Here is some sample code to demonstrate some of the PowerShell service management capabilities. The first example is to stop a service, perform … Continue reading

Posted in System Administration | Tagged | Leave a comment

Advanced Query Syntax (AQS) Properties for Exchange Search-Mailbox

I had some trouble finding a list of AQS (Advanced Query Syntax) properties supported by the Exchange Search-Mailbox -SearchQuery parameter. I did find a link mentioned in a comment by Tony Redmond on his article “Using Search-Mailbox to look for … Continue reading

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