Compare commits

..
2 Commits
Author SHA1 Message Date
dyoder 9409f000e0 use new func in Tools.ps1 to get random file 2023-10-05 14:23:06 -04:00
dyoder 0499a143ef added 2 new funcs for getting temp files 2023-10-05 14:22:37 -04:00
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
# Run SFC to check the filesystem, convert the result from Unicode to UTF8, delete the intermediate $tempFile
$tempFile = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName())
$tempFile = Get-RandomTempFile
$(sfc.exe /scannow) | Out-File $tempFile
Set-Content -Path $tempFile -Value $(Get-Content -Path $tempFile -Encoding Unicode) -Encoding UTF8
$SFCOutput = Get-Content -Path $tempFile
+6
View File
@@ -269,6 +269,12 @@ Function IsWindowsBuild {
# Get the path to the TEMP folder (context dependent)
Function Get-TempPath { Return [System.IO.Path]::GetTempPath() }
# Get a random file name with random extension
Function Get-RandomFile { Return [System.IO.Path]::GetRandomFileName() }
# Get a random temp file in the current TEMP folder
Function Get-RandomTempFile { Return [System.IO.Path]::Combine($(Get-TempPath), $(Get-RandomFile)) }
# Determine if the system is 64-bit or not
Function Is64bit {
switch ( $(Get-CimInstance -ClassName Win32_OperatingSystem -Property OSArchitecture | Select-Object -ExpandProperty OSArchitecture) )