Showing results for Scripting Guys Update - PowerShell Community

Mar 13, 2021
2
2

Determine if a folder exists

Fabian Baumanis
Fabian Baumanis

Q: Is there any way to determine whether or not a specific folder exists on a computer? A: There are loads of ways you can do this. The Test-Path Cmdlet The easiest way to do this is to use the cmdlet. It looks for a given path and returns if it exists, otherwise it returns . You could evaluate the result of the like in the code snippet below...

Scripting Guys UpdateFileTest-Path
Mar 5, 2021
5
1

Reading a text file bottom up

@DoctorDNS
@DoctorDNS

Q: I have a log file in which new data is appended to the end of the file. That means the most recent entries are at the end of the file. I’d like to be able to read the file starting with the last line and then ending with the first line, but I can’t figure out how to do that. A: There are loads of ways you can do this. A simple way is to use...

Scripting Guys UpdateArray
Feb 26, 2021
1
1

Getting Yesterday’s Date

@DoctorDNS
@DoctorDNS

Q: How can I get yesterday's date? A: You can use a combination of the cmdlet and .NET Time/Date methods. First, let's look at dates in PowerShell and .NET Then we can look at how to calculate yesterday and use that in your scripts. Dates in PowerShell Let's start by looking at how you can deal with dates and times. As you probably know, ...

Scripting Guys Update.NET
Feb 19, 2021
8
0

Changing Drive Letters and Labels via PowerShell

@DoctorDNS
@DoctorDNS

Q: I want to change the drive letter and the drive label for a new USB drive. Is there a way with PowerShell? A: Of course. One way is to use WMI and the CIM cmdlets. PowerShell does not have a cmdlet to change the drive letter or the caption directly. But the good news is that you can use WMI and the CIM cmdlets to change both the drive letter ...

Scripting Guys Update

Feedback