Skip to content

Commit 38f864f

Browse files
fixed pspaths
1 parent 83c4b7f commit 38f864f

File tree

3 files changed

+36
-27
lines changed

3 files changed

+36
-27
lines changed

AppOptimizeAndConfig.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,17 @@
6464
Function Test-IsISE {
6565
# try...catch accounts for:
6666
# Set-StrictMode -Version latest
67-
try {
68-
return $psISE -ne $null;
69-
}
70-
catch {
71-
return $false;
72-
}
67+
try {
68+
return $psISE -ne $null;
7369
}
74-
70+
catch {
71+
return $false;
72+
}
73+
}
74+
7575
Function Get-ScriptPath {
76+
If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
77+
7678
# Makes debugging from ISE easier.
7779
if ($PSScriptRoot -eq "")
7880
{
@@ -90,8 +92,9 @@ Function Get-ScriptPath {
9092
}
9193
else
9294
{
93-
#$root = $PSScriptRoot
94-
$MyInvocation.MyCommand.Path
95+
#$PSScriptRoot
96+
$PSCommandPath
97+
#$MyInvocation.MyCommand.Path
9598
}
9699
}
97100

Win10OptimizeAndConfig.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,17 @@
161161
Function Test-IsISE {
162162
# try...catch accounts for:
163163
# Set-StrictMode -Version latest
164-
try {
165-
return $psISE -ne $null;
166-
}
167-
catch {
168-
return $false;
169-
}
164+
try {
165+
return $psISE -ne $null;
170166
}
171-
167+
catch {
168+
return $false;
169+
}
170+
}
171+
172172
Function Get-ScriptPath {
173+
If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
174+
173175
# Makes debugging from ISE easier.
174176
if ($PSScriptRoot -eq "")
175177
{
@@ -187,8 +189,9 @@ Function Get-ScriptPath {
187189
}
188190
else
189191
{
190-
#$root = $PSScriptRoot
191-
$MyInvocation.MyCommand.Path
192+
#$PSScriptRoot
193+
$PSCommandPath
194+
#$MyInvocation.MyCommand.Path
192195
}
193196
}
194197

Win10STIGAndMitigations.ps1

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@
5757
Function Test-IsISE {
5858
# try...catch accounts for:
5959
# Set-StrictMode -Version latest
60-
try {
61-
return $psISE -ne $null;
62-
}
63-
catch {
64-
return $false;
65-
}
60+
try {
61+
return $psISE -ne $null;
6662
}
67-
63+
catch {
64+
return $false;
65+
}
66+
}
67+
6868
Function Get-ScriptPath {
69+
If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
70+
6971
# Makes debugging from ISE easier.
7072
if ($PSScriptRoot -eq "")
7173
{
@@ -83,8 +85,9 @@ Function Get-ScriptPath {
8385
}
8486
else
8587
{
86-
#$root = $PSScriptRoot
87-
$MyInvocation.MyCommand.Path
88+
#$PSScriptRoot
89+
$PSCommandPath
90+
#$MyInvocation.MyCommand.Path
8891
}
8992
}
9093

0 commit comments

Comments
 (0)