PowerShell Logging – The Basics

PowerShell Logging will be the best thing you learn.  The biggest topic I get asked for help outside the specific activities I am assigned to is PowerShell.    I will be the first to understand everyone has their own style.  I never judge the style or syntax format.  Besides that, PowerShell logging ALWAYS needs to occur.  If you are not logging, your running blind. PowerShell logging is the one the most powerful features you can learn and implement.  

PowerShell does have some native abilities, “Start-Transcript“, and if that is all you want to understand, that is fine.   But, this post will take you through some basic understandings on capturing your outputs in a format that is readable and standard.  With some tricks in creating some great logic around managing your log.

PowerShell Logging – The Setup

The first step into your new logging endeavors is to understand the ability to call a function to simplify your process. 

For this function to become usable we first must set the variable “$logpath” so the function can understand where it is writing to.   My standard is to log to “%SystemDrive%\Windows\Temp”

# Set log path
$logpath = "$env:SystemDrive\Windows\Temp\mynewlog.log"

# Function to write to log file
function Write-Log
{
	param($msg)
	"$(Get-Date -Format G) : $msg" | Out-File -FilePath $logpath -Append -Force
}

Calling the Function

During your process of creating your script you will want to call the PowerShell logging function to say your going to run a process, log the process file call, its arguments, other module calls, and most important capturing any error output. 

Write-Log "Running:"
Write-Log "setup.exe -S -v/l "$env:SystemDrive\Windows\Temp\Setup.log"

Continue reading

Configuration Manager (SCCM) Power BI Reporting

I would like to introduce you to the next generation of endpoint reporting we created at Ascent Solutions.  System Center Configuration Manager (SCCM) vNext Reporting with Microsoft Power BI. Microsoft Power BI is the insight engine that your organization needs.  Not with just Configuration Manager reporting, but extending out into your cloud, data center, ITSM, ITAM, and even your security vulnerability scanning appliance. 

Does your organization have a grip on client reporting health, let alone if your getting the latest Windows updates deployed.  These are tough questions to ask new customer’s when we need to properly plan a new roll out.  

This video takes you through some developed possibilities.  These solutions are in constant development. I am adding new insights weekly to these reports. Microsoft’s Power BI give us no limits into your organizational IT makeup, including but, not even close, limited to, Microsoft Operations Management Suite, Azure SQL, Amazon RedShift, Oracle, and MySQL, and etc….

Continue reading