forked from microsoft/ExPerfWiz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExPerfwiz.psm1
42 lines (35 loc) · 1.89 KB
/
ExPerfwiz.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#############################################################################################
# DISCLAIMER: #
# #
# THE SAMPLE SCRIPTS ARE NOT SUPPORTED UNDER ANY MICROSOFT STANDARD SUPPORT #
# PROGRAM OR SERVICE. THE SAMPLE SCRIPTS ARE PROVIDED AS IS WITHOUT WARRANTY #
# OF ANY KIND. MICROSOFT FURTHER DISCLAIMS ALL IMPLIED WARRANTIES INCLUDING, WITHOUT #
# LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR OF FITNESS FOR A PARTICULAR #
# PURPOSE. THE ENTIRE RISK ARISING OUT OF THE USE OR PERFORMANCE OF THE SAMPLE SCRIPTS #
# AND DOCUMENTATION REMAINS WITH YOU. IN NO EVENT SHALL MICROSOFT, ITS AUTHORS, OR #
# ANYONE ELSE INVOLVED IN THE CREATION, PRODUCTION, OR DELIVERY OF THE SCRIPTS BE LIABLE #
# FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS #
# PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) #
# ARISING OUT OF THE USE OF OR INABILITY TO USE THE SAMPLE SCRIPTS OR DOCUMENTATION, #
# EVEN IF MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES #
#############################################################################################
# ============== Utility Functions ==============
# Writes output to a log file with a time date stamp
Function Out-LogFile {
Param
(
[Parameter(Mandatory = $true)]
[string]$String,
[Parameter(Mandatory = $true)]
[bool]$Quiet
)
# Get our log file path
$LogFile = Join-path $env:LOCALAPPDATA ExPefwiz.log
# Get the current date
[string]$date = Get-Date -Format G
# Build output string
[string]$logstring = ( "[" + $date + "] - " + $string)
# Write everything to our log file and the screen
$logstring | Out-File -FilePath $LogFile -Append
if (!$Quiet) { Write-Information -MessageData $logstring -InformationAction Continue }
}