Some users complained about their drive is not mapping on the computer. After some researches, we found the path was blank on their Home folder in the profile. So, I created a PowerShell script to fix it massively. I use the "if loop" to check if the home directory path is blank. If it is { Read More }
PowerShell: speed up Get-ChildItem to scan files in a large file system
I wrote a PowerShell script for scanning PST files in the file system. The part of script likes the below code. However, it takes very long time to complete the scan. It took about 19-21 hours to scan PST files in the 28 TB file system. I found the key point to slow down the scan is the line { Read More }
Add data into SQL database by PowerShell Script – ExecuteNonQuery with 0 arguments: Incorrect syntax near ‘S’
I have a PowerShell script for PST scan in the file system. The result is in a PSObject. When I added the result into SQL database, it threw an error. After debugging, I found that the error "ExecuteNonQuery with 0 arguments: Incorrect syntax near 'S'" was from a directory path. Here is the part { Read More }
Select random objects from a list by PowerShell
I run a giveaway campaign recently. After the campaign end, I will have to select a winner. In the beginning, I was thinking that open a book on the random page to select a winner. However, it is not professional, and it cannot be recorded. So, I decide to write a PowerShell script for it. I am { Read More }