In this article, our guest blogger—Brent Challis—provides a different approach to retrieving the correct Documents folder.
The Problem
One of the problems working with multiple computers is that the Documents folder path could be:
C:\Users\<user>\OneDrive\Documentsor C:\Users\<user>\Documents
There are many…
Read More
In this article, our guest blogger—Brent Challis—provides an example of how to emulate the Linux sudo (super user do) command in PowerShell.
I am confident that I am not the only person to experience the problem of opening a PowerShell…
Read More
As a follow-up to our Advanced PowerShell Functions: Begin to Process to End article, the following article will dive deeper into the CmdletBinding attribute.
Let’s start with defining a function:
Function Test-ScriptBlock
{
[CmdletBinding()]
Param
(
[Parameter(ValueFromPipeline)]
[int[]]
$Numbers…
Read More
As of the KB3000850 update and PowerShell 5.0, PowerShell has included script block logging so that admins would have more tools for the blue team side of pen testing. If you’re unfamiliar or have never heard of it before, I…
Read More
Recently on the forums we had a user who wanted to know why he couldn’t initialize the form controls within the OnApplicationLoad function. Seeing how this can result in some confusion, we would like to elaborate on the subject.
The…
Read More
A while ago I published a short function to create CSV strings. While working on another task I came across $OFS, which is something I know about but never really think about. $OFS is an intrinsic PowerShell variable that controls…
Read More
Sometimes it’s the little things that can make life easier. Here’s one of them. We know that PowerShell treats comma separated items as an array:
PS C:\> $a=”a”,1,”b”,”jeff”,4
PS C:\> $aa1bjeff4PS C:\>
But what if you want back in its…
Read More
One drawback to the service objects returned from Get-Service is that you can’t see what account the service is running under, often referred to as the service account. This will be something like LocalService or perhaps even a special user…
Read More
Of course since I’ve posted a VBScript version of the Tree command, I had to do it in PowerShell. On one hand, this would have been pretty straightforward since PowerShell can use COM objects and I could have simply reused…
Read More
I love that part of my job is helping people out in the forums as ScriptingAnswers.com. A recent post asked about finding out what network drives were mapped on a remote computer using PowerShell. The task sounded familiar so I…
Read More