moved specific functions from Tools.ps1 to Get-InstalledSoftware.ps1
added additional processing features
This commit is contained in:
@@ -41,28 +41,6 @@ Function LogErr {
|
||||
Add-Content -Path $LogFile -Value $LogEntry
|
||||
}
|
||||
|
||||
## Function to append a line to a file
|
||||
Function Write-LineToFile {
|
||||
param([Parameter(Mandatory=$true)][string]$Path,[Parameter(Mandatory=$true)][string]$Line)
|
||||
If ( -not (Test-Path $Path) ) {
|
||||
LogMsg "Creating file ""${Path}"""
|
||||
Try { New-Item -Path $Path -ItemType File -Force | Out-Null }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
Try { Add-Content -Path $Path -Value $Line }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Function to test whether or not an item has a specified property
|
||||
Function Test-ItemProperty {
|
||||
param([Parameter(Mandatory=$true)][string]$Path,[Parameter(Mandatory=$true)][string]$Name)
|
||||
Try {
|
||||
$test = Get-ItemProperty -Path $Path -Name $Name -ErrorAction SilentlyContinue
|
||||
If (($test -eq $null) -or ($test.Length -eq 0)) { Return $false } Else { Return $true }
|
||||
}
|
||||
Catch { Return $false }
|
||||
}
|
||||
|
||||
## Function to determine if the current user context is an Administrator
|
||||
Function IsAdmin {
|
||||
If ( ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) )
|
||||
|
||||
Reference in New Issue
Block a user