-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMulti_Function_Logging.ps1
More file actions
49 lines (41 loc) · 1.97 KB
/
Multi_Function_Logging.ps1
File metadata and controls
49 lines (41 loc) · 1.97 KB
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
43
44
45
46
47
48
49
#Import Module
Remove-Module -name PS.SCCMOG.Tools -Force -ErrorAction SilentlyContinue
Import-Module .\PS.SCCMOG.Tools.psd1 -Force -Verbose
#######################################################################################
#Begin Region
#######################################################################################
Set-OGLogEntryPath -Path "$env:programdata\logs\TestingOverWrite.Log" -Force -Verbose
Enable-OGLogMutex -Enable -Verbose
Set-OGEventLogLogging -Enabled -Default -Verbose
Write-OGLogEntry -logtype Header
######################################################################################
#Global Variables
######################################################################################
# $global:PS_NEWOGLogEntry_DEFAULT_LOGDIR = ""
# $global:PS_SCCMOG_cScriptName = ""
# $global:PS_NEWOGLogEntry_DEFAULT_LOGPATH = ""
#######################################################################################
#Main Region
#######################################################################################
Write-OGLogEntry -logText "Testing Error" -logtype Error
Write-OGLogEntry -logText "Testing Info" -logtype Info
Write-OGLogEntry -logText "Testing Warning" -logtype Warning
function simplefunction (){
Write-OGLogEntry -logText "simplefunction" -logtype Warning
#Get-PSCallStack | Select-Object -Property *
}
function anothersimplefunction (){
Write-OGLogEntry -logText "anothersimplefunction" -logtype Warning
simplefunction
}
anothersimplefunction
#Spawn Another Process
$processResult = $null
$processResult = Start-Process Powershell -argument "-noprofile .\Tester2.ps1 -LogFilePath '$Global:PS_NEWOGLogEntry_DEFAULT_LOGPATH'" -NoNewWindow -PassThru
$processResult.WaitForExit()
#$processResult
#Get-PSCallStack
#######################################################################################
#Finish Region
#######################################################################################
Write-OGLogEntry -logtype Footer