-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathHealthDashboard.ps1
624 lines (499 loc) · 23.3 KB
/
HealthDashboard.ps1
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
#Requires -Version 5
#Requires -Modules PSWriteHTML
<#
.SYNOPSIS
Script that creates a dashboard with the basic health of the CyberArk environment
.DESCRIPTION
This script polls each of the 4 PVWA's, CPM and PSM to check the CyberArk services statuses and backup scheduled tasks and
then compiles the information into a .HTML file. Once the .HTML file is generated, this script will copy the index.html file
to each of the 4 PVWA's C:\inetpub\wwwroot\Health directories
.NOTES
Name: Get-CyberArkHealth.ps1
Author: Kevin Elwell <[email protected]>
DateCreated: 2020-05-22
ModifiedBy: James Ashley <[email protected]>
DateUpdated: 2021-02-2
Site: https://cyberarkweb.local/health
Version: 2.0
Credit to Jaap Brasser for his Get-ScheduledTask.ps1 script
Link: https://github.com/jaapbrasser/SharedScripts/tree/master/Get-ScheduledTask
Credit to evotec for their PSWriteHTML PowerShell modules
Link: https://github.com/EvotecIT/PSWriteHTML
.TODO
Create a .ini/.json file to hold the values of the server names and
have the script dymanically run for each server instead of hard coding the
server names into the script
Add logic to dynamically update maintenance message colors
Rewrite output to a different format?
#>
$fail = $False
#region Get-ScheduledTask Function
Function Get-ScheduledTask {
<#
.SYNOPSIS
Script that returns scheduled tasks on a computer
.DESCRIPTION
This script uses the Schedule.Service COM-object to query the local or a remote computer in order to gather a formatted list including the Author, UserId and description of the task. This information is parsed from the XML attributed to provide a more human readable format
.PARAMETER Computername
The computer that will be queried by this script, local administrative permissions are required to query this information
.NOTES
Name: Get-ScheduledTask.ps1
Author: Jaap Brasser
DateCreated: 2012-05-23
DateUpdated: 2015-08-17
Site: http://www.jaapbrasser.com
Version: 1.3.2
.LINK
http://www.jaapbrasser.com
.EXAMPLE
.\Get-ScheduledTask.ps1 -ComputerName server01
Description
-----------
This command query mycomputer1 and display a formatted list of all scheduled tasks on that computer
.EXAMPLE
.\Get-ScheduledTask.ps1
Description
-----------
This command query localhost and display a formatted list of all scheduled tasks on the local computer
.EXAMPLE
.\Get-ScheduledTask.ps1 -ComputerName server01 | Select-Object -Property Name,Trigger
Description
-----------
This command query server01 for scheduled tasks and display only the TaskName and the assigned trigger(s)
.EXAMPLE
.\Get-ScheduledTask.ps1 | Where-Object {$_.Name -eq 'TaskName') | Select-Object -ExpandProperty Trigger
Description
-----------
This command queries the local system for a scheduled task named 'TaskName' and display the expanded view of the assisgned trigger(s)
.EXAMPLE
Get-Content C:\Servers.txt | ForEach-Object { .\Get-ScheduledTask.ps1 -ComputerName $_ }
Description
-----------
Reads the contents of C:\Servers.txt and pipes the output to Get-ScheduledTask.ps1 and outputs the results to the console
#>
param(
[string]$ComputerName = $env:COMPUTERNAME,
[switch]$RootFolder
)
#region Functions
function Get-AllTaskSubFolders {
[cmdletbinding()]
param (
# Set to use $Schedule as default parameter so it automatically list all files
# For current schedule object if it exists.
$FolderRef = $Schedule.getfolder("\")
)
if ($FolderRef.Path -eq '\') {
$FolderRef
}
if (-not $RootFolder) {
$ArrFolders = @()
if (($Folders = $folderRef.getfolders(1))) {
$Folders | ForEach-Object {
$ArrFolders += $_
if ($_.getfolders(1)) {
Get-AllTaskSubFolders -FolderRef $_
}
}
}
$ArrFolders
}
}
function Get-TaskTrigger {
[cmdletbinding()]
param (
$Task
)
$Triggers = ([xml]$Task.xml).task.Triggers
if ($Triggers) {
$Triggers | Get-Member -MemberType Property | ForEach-Object {
$Triggers.($_.Name)
}
}
}
#endregion Functions
try {
$Schedule = New-Object -ComObject 'Schedule.Service'
}
catch {
Write-Warning "Schedule.Service COM Object not found, this script requires this object"
return
}
$Schedule.connect($ComputerName)
$AllFolders = Get-AllTaskSubFolders
foreach ($Folder in $AllFolders) {
if (($Tasks = $Folder.GetTasks(1))) {
$Tasks | Foreach-Object {
New-Object -TypeName PSCustomObject -Property @{
'Name' = $_.name
'Path' = $_.path
'State' = switch ($_.State) {
0 { 'Unknown' }
1 { 'Disabled' }
2 { 'Queued' }
3 { 'Ready' }
4 { 'Running' }
Default { 'Unknown' }
}
'Enabled' = $_.enabled
'LastRunTime' = $_.lastruntime
'LastTaskResult' = $_.lasttaskresult
'NumberOfMissedRuns' = $_.numberofmissedruns
'NextRunTime' = $_.nextruntime
'Author' = ([xml]$_.xml).Task.RegistrationInfo.Author
'UserId' = ([xml]$_.xml).Task.Principals.Principal.UserID
'Description' = ([xml]$_.xml).Task.RegistrationInfo.Description
'Trigger' = Get-TaskTrigger -Task $_
'ComputerName' = $Schedule.TargetServer
}
}
}
}
}
#endregion Get-ScheduledTask Function
#region Get-CAService Function
# Function for querying a service on a remote machine
Function Get-CAServices {
param (
[parameter(Mandatory = $False)]
[string]$CAServerName)
$CAserviceshealth = $null
$CAservices = @(
"IISAdmin",
"W3Svc",
"CyberArk Central Policy Manager Scanner",
"CyberArk Password Manager",
"CyberArk Scheduled Tasks",
"CyberArk Application Password Provider",
"Cyber-Ark Privileged Session Manager"
)
try {
$servicestates = @(Get-WmiObject -ComputerName $CAServerName -Class Win32_Service -ErrorAction STOP | Where-Object { $CAservices -icontains $_.Name } | Select-Object name, state, startmode)
}
catch {
#if ($Log) {Write-LogFile $_.Exception.Message}
Write-Warning $_.Exception.Message
$CAserviceshealth = "Fail"
$fail = $True
}
#Return $servicestates.Name, $servicestates.StartMode, $servicestates.State, $servicestates.Status
Return $servicestates
}
#endregion Get-CAService Function
#region Get-CAComponentStatus Function
function Get-CAComponentStatus {
param (
[parameter(Mandatory = $true)]
[array]$Servers
)
$ServiceStatus = New-Object System.Collections.ArrayList
$Messages = New-Object System.Collections.ArrayList
$ComponentStatus = $null
$ServerStatus = $null
$ServerStatusArray = New-Object System.Collections.ArrayList
foreach ($Machine in $Servers) {
$s = Get-CAServices -CAServerName $Machine
foreach ($Item in $s) {
$ServiceObj = [PSCustomObject]@{
Server = $Machine
ServiceName = $Item.Name
State = $Item.state
StartMode = $Item.StartMode
}
[void]($ServiceStatus.Add($ServiceObj))
Remove-Variable ServiceObj -ErrorAction SilentlyContinue
}
$sm = $s.StartMode
$st = $s.State
If ($sm -icontains "Disabled") {
$mess = "ALL ENABLED SERVICES ARE RUNNING"
$ServerStatus = "Good"
}
If ($sm -inotcontains "Disabled" -and $st -ieq "Running") {
$mess = "ALL SERVICES ARE RUNNING"
$ServerStatus = "Good"
}
If ($st -icontains "Stopped" -and $sm -inotcontains "Disabled") {
$mess = "ONE OR MORE SERVICES APPEAR TO BE DOWN!"
$ServerStatus = "Bad"
}
If ($st -icontains "Stopped" -and $sm -inotcontains "Disabled" -and $s.Name -eq "Cyber-Ark Privileged Session Manager") {
$mess = "All SERVICES ARE RUNNING OR WAITING TO BE STARTED"
$ServerStatus = "Bad"
}
$MessageObj = [PSCustomObject]@{
Server = $Machine
Message = $mess
}
[void]($ServerStatusArray.Add($ServerStatus))
[void]($Messages.Add($MessageObj))
Remove-Variable MessageObj -ErrorAction SilentlyContinue
}
if ($ServerStatusArray -contains 'Bad') {
$ComponentStatus = 'Bad'
}
else {
$ComponentStatus = 'Good'
}
return $ServiceStatus, $Messages, $ComponentStatus
}
#endregion Get-CAComponentStatus Function
# Set Variable to hold the maintenance message
$MaintMessage = "NO SCHEDULED MAINTENANCE AT THIS TIME"
# ============================================================
$PVWAServers = @('PVWA1','PVWA2')
$PVWAServiceStatus = New-Object System.Collections.ArrayList
$PVWAMessages = New-Object System.Collections.ArrayList
$PVWAComponentStatus = $null
$CCPServers = @('CCP1,CCP2')
$CCPServiceStatus = New-Object System.Collections.ArrayList
$CCPMessages = New-Object System.Collections.ArrayList
$CCPComponentStatus = $null
$CPMServers = @('CPM1')
$CPMServiceStatus = New-Object System.Collections.ArrayList
$CPMMessages = New-Object System.Collections.ArrayList
$CPMComponentStatus = $null
$PSMServers = @('PSM1','PSM2')
$PSMServiceStatus = New-Object System.Collections.ArrayList
$PSMMessages = New-Object System.Collections.ArrayList
$PSMComponentStatus = $null
#PVWA
$PVWAServiceStatus, $PVWAMessages, $PVWAComponentStatus = Get-CAComponentStatus $PVWAServers
#CPM
$CPMServiceStatus, $CPMMessages, $CPMComponentStatus = Get-CAComponentStatus $CPMServers
# Check the scheduled tasks that perform the incremental and full backups
$CASchedTask1 = "CyberArkFullBackup"
$CASchedTask1Upper = $CASchedTask1.TrimStart("CyberArk ").ToUpper()
$CASchedTask2 = "CyberArkIncrementalBackup"
$CASchedTask2Upper = $CASchedTask2.TrimStart("CyberArk ").ToUpper()
$CASchedTask1Result = Get-ScheduledTask | Where-Object { $_.Name -eq $CASchedTask1 } | Select-Object -Property *
$CASchedTask2Result = Get-ScheduledTask | Where-Object { $_.Name -eq $CASchedTask2 } | Select-Object -Property *
#$CASchedTask1Result = Get-ScheduledTask -ComputerName $CPM1 | Where-Object {$_.Name -eq $CASchedTask1} | Select-Object -Property *
#$CASchedTask2Result = Get-ScheduledTask -ComputerName $CPM1 | Where-Object {$_.Name -eq $CASchedTask2} | Select-Object -Property *
$task1Result = $CASchedTask1Result.LastTaskResult
$task1LastRuntime = $CASchedTask1Result.LastRunTime
$task1NextRuntime = $CASchedTask1Result.NextRunTime
$task1Enabled = $CASchedTask1Result.Enabled
$task2Result = $CASchedTask2Result.LastTaskResult
$task2LastRuntime = $CASchedTask2Result.LastRunTime
$task2NextRuntime = $CASchedTask2Result.NextRunTime
$task2Enabled = $CASchedTask2Result.Enabled
#PSM
$PSMServiceStatus, $PSMMessages, $PSMComponentStatus = Get-CAComponentStatus $PSMServers
#CCP
$CCPServiceStatus, $CCPMessages, $CCPComponentStatus = Get-CAComponentStatus $CCPServers
# ============================================================
Import-Module -Name PSWriteHTML -Force
New-HTML -AutoRefresh 120 -FavIcon "https://cyberark.local/PasswordVault/v10/favicon.ico" -TitleText "CyberArk Service Status" -Online {
New-HTMLContent -CanCollapse {
New-HTMLContainer {
New-HTMLPanel -Invisible {
New-HTMLHeading -Heading h1 -HeadingText 'MAINTENANCE' -Color Black
New-HTMLToast -TextHeader 'SCHEDULED MAINTENANCE' -Text $MaintMessage -TextColor Black -BarColorLeft Green -BarColorRight Green -IconRegular check-circle -IconColor Green
}
}
New-HTMLContainer {
New-HTMLPanel -Invisible {
New-HTMLHeading -Heading h1 -HeadingText 'LAST STATUS CHECK' -Color Black
New-HTMLToast -TextHeader 'DATE / TIME' -Text (Get-Date) -TextColor Black -BarColorLeft Cyan -BarColorRight Cyan -IconRegular clock -IconColor Black
}
}
New-HTMLContainer {
New-HTMLPanel -Invisible {
New-HTMLHeading -Heading h1 -HeadingText 'BACKUPS STATUS CHECK' -Color Black
If ($task1Result -eq 0) {
$task1ResultColor = "Green"
$task1ResultIcon = "thumbs-up"
}
else {
$task1ResultColor = "Red"
$task1ResultIcon = "thumbs-down"
}
If ($task2Result -eq 0) {
$task2ResultColor = "Green"
$task2ResultIcon = "thumbs-up"
}
else {
$task2ResultColor = "Red"
$task2ResultIcon = "thumbs-down"
}
New-HTMLToast -Text "$CASchedTask1Upper - LAST RUN TIME: $task1LastRuntime" -TextColor Black -BarColorLeft $task1ResultColor -BarColorRight $task1ResultColor -IconSolid $task1ResultIcon -IconColor $task1ResultColor
New-HTMLToast -Text "$CASchedTask2Upper - LAST RUN TIME: $task2LastRuntime" -TextColor Black -BarColorLeft $task2ResultColor -BarColorRight $task2ResultColor -IconSolid $task2ResultIcon -IconColor $task2ResultColor
}
}
}
#region PVWAHTML
if ($PVWAComponentStatus -eq 'Good') {
$PVWAStatusColor = 'Green'
}
else {
$PVWAStatusColor = 'Red'
}
New-HTMLContent -CanCollapse -HeaderText "PVWA" -HeaderBackGroundColor $PVWAStatusColor {
foreach ($Server in $PVWAServers) {
$Message = ($PVWAMessages | Where-Object { $_.Server -eq $Server }).Message
$ComponentServiceStatus = $PVWAServiceStatus | Where-Object { $_.Server -eq $Server }
New-HTMLContainer {
New-HTMLPanel -Invisible {
If (!($fail) -and $Message -ne "ONE OR MORE SERVICES APPEAR TO BE DOWN!") {
New-HTMLToast -TextHeader "PVWA STATUS - $Server" -Text $Message -TextColor Green -BarColorLeft Green -TextHeaderColor Green -BarColorRight Green -IconSolid thumbs-up -IconColor Green
}
else {
New-HTMLToast -TextHeader "ERROR - $Server" -Text $Message -BarColorLeft Red -TextHeaderColor Red -BarColorRight Red -TextColor Red -IconSolid thumbs-down -IconColor Red
}
}
New-HTMLPanel -Invisible {
New-HTMLStatus {
foreach ($Status in $ComponentServiceStatus) {
If ($Status.State -ieq "Running") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular check-circle
}
elseif ($Status.State -ine "Running" -and $Status.startmode -ieq "Disabled") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.StartMode -IconRegular pause-circle -BackgroundColor Yellow
}
elseif ($Status.State -ne $null) {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular times-circle -BackgroundColor Red
}
}
}
}
}
}
}
#endregion PVWAHTML
#region CCPHTML
if ($CCPComponentStatus -eq 'Good') {
$CCPStatusColor = 'Green'
}
else {
$CCPStatusColor = 'Red'
}
New-HTMLContent -CanCollapse -HeaderText "CCP" -HeaderBackGroundColor $CCPStatusColor {
foreach ($Server in $CCPServers) {
$Message = ($CCPMessages | Where-Object { $_.Server -eq $Server }).Message
$ComponentServiceStatus = $CCPServiceStatus | Where-Object { $_.Server -eq $Server }
New-HTMLContainer {
New-HTMLPanel -Invisible {
If (!($fail) -and $Message -ne "ONE OR MORE SERVICES APPEAR TO BE DOWN!") {
New-HTMLToast -TextHeader "CCP STATUS - $Server" -Text $Message -TextColor Green -BarColorLeft Green -TextHeaderColor Green -BarColorRight Green -IconSolid thumbs-up -IconColor Green
}
else {
New-HTMLToast -TextHeader "ERROR - $Server" -Text $Message -BarColorLeft Red -TextHeaderColor Red -BarColorRight Red -TextColor Red -IconSolid thumbs-down -IconColor Red
}
}
New-HTMLPanel -Invisible {
New-HTMLStatus {
foreach ($Status in $ComponentServiceStatus) {
If ($Status.State -ieq "Running") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular check-circle
}
elseif ($Status.State -ine "Running" -and $Status.startmode -ieq "Disabled") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.StartMode -IconRegular pause-circle -BackgroundColor Yellow
}
elseif ($Status.State -ne $null) {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular times-circle -BackgroundColor Red
}
}
}
}
}
}
}
#endregion CCP HTML
#region CPM HTML
if ($CPMComponentStatus -eq 'Good') {
$CPMStatusColor = 'Green'
}
else {
$CPMStatusColor = 'Red'
}
New-HTMLContent -CanCollapse -HeaderText "CPM" -HeaderBackGroundColor $CPMStatusColor {
foreach ($Server in $CPMServers) {
$Message = ($CPMMessages | Where-Object { $_.Server -eq $Server }).Message
$ComponentServiceStatus = $CPMServiceStatus | Where-Object { $_.Server -eq $Server }
New-HTMLContainer {
New-HTMLPanel -Invisible {
If (!($fail) -and $Message -ne "ONE OR MORE SERVICES APPEAR TO BE DOWN!") {
New-HTMLToast -TextHeader "CPM STATUS - $Server" -Text $Message -TextColor Green -BarColorLeft Green -TextHeaderColor Green -BarColorRight Green -IconSolid thumbs-up -IconColor Green
}
else {
New-HTMLToast -TextHeader "ERROR - $Server" -Text $Message -BarColorLeft Red -TextHeaderColor Red -BarColorRight Red -TextColor Red -IconSolid thumbs-down -IconColor Red
}
}
New-HTMLPanel -Invisible {
New-HTMLStatus {
foreach ($Status in $ComponentServiceStatus) {
If ($Status.State -ieq "Running") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular check-circle
}
elseif ($Status.State -ine "Running" -and $Status.startmode -ieq "Disabled") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.StartMode -IconRegular pause-circle -BackgroundColor Yellow
}
elseif ($Status.State -ne $null) {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular times-circle -BackgroundColor Red
}
}
}
}
}
}
}
#endregion CPM HTML
#region PSM HTML
if ($PSMComponentStatus -eq 'Good') {
$PSMStatusColor = 'Green'
}
else {
$PSMStatusColor = 'Red'
}
New-HTMLContent -CanCollapse -HeaderText "PSM" -HeaderBackGroundColor $PSMStatusColor {
foreach ($Server in $PSMServers) {
$Message = ($PSMMessages | Where-Object { $_.Server -eq $Server }).Message
$ComponentServiceStatus = $PSMServiceStatus | Where-Object { $_.Server -eq $Server }
New-HTMLContainer {
New-HTMLPanel -Invisible {
If (!($fail) -and $Message -ne "ONE OR MORE SERVICES APPEAR TO BE DOWN!") {
New-HTMLToast -TextHeader "PSM STATUS - $Server" -Text $Message -TextColor Green -BarColorLeft Green -TextHeaderColor Green -BarColorRight Green -IconSolid thumbs-up -IconColor Green
}
else {
New-HTMLToast -TextHeader "ERROR - $Server" -Text $Message -BarColorLeft Red -TextHeaderColor Red -BarColorRight Red -TextColor Red -IconSolid thumbs-down -IconColor Red
}
}
New-HTMLPanel -Invisible {
New-HTMLStatus {
foreach ($Status in $ComponentServiceStatus) {
If ($Status.State -ieq "Running") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular check-circle
}
elseif ($Status.State -ine "Running" -and $Status.startmode -ieq "Disabled") {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.StartMode -IconRegular pause-circle -BackgroundColor Yellow
}
elseif ($Status.State -ne $null) {
New-HTMLStatusItem -Name $Status.ServiceName -Status $Status.State -IconRegular times-circle -BackgroundColor Red
}
}
}
}
}
}
}
#endregion PSM HTML
} -FilePath "D:\CyberArkAutomation\HealthDashboard\index.html" #-ShowHTML
#===========================================================
# Add logic here to copy the index.html to each of the PVWA's
# C:\inetpub\wwwroot\Health directories
Foreach ($p in $PVWAServers) {
write-Host "pvwa name is " $p
Try {
$fc = If (!(Test-Path -LiteralPath "\\$p\C$\inetpub\wwwroot\Health")) {
New-Item -ItemType "directory" -Path "\\$p\C$\inetpub\wwwroot\Health" -Force
}
$cpresult = Copy-Item -Path "D:\CyberArkAutomation\HealthDashboard\index.html" -Destination "\\$p\C$\inetpub\wwwroot\Health" -Force
$cpresult
}
Catch {
Write-Warning $_.Exception.Message
}
}
Remove-Item -Path "D:\CyberArkAutomation\HealthDashboard\index.html"
#===========================================================