Avatar of Sekar Chinnakannu
Sekar Chinnakannu
Flag for Singapore

asked on 

How to eliminate the special character - and goto next in powershell

I have script which works fine when I remove special character - from script, but the device send alert with -. I need to skip - in my powershell to proceed with running the script successfully.

PowerShell.Exe -File C:\abcd.ps1 RAISED Interface Status Alert: interface8 - Ethernet0 - Gi0 is Up

C:\Users\>PowerShell.Exe -File C:\abcd.ps1 RAISED Interface Status Alert: interface8 - Ethernet0 - Gi0 is Up at 11:53:10

The error below
C:\abcd.ps1 : Cannot process argument because the value of
argument "name" is not valid. Change the value of the "name" argument and run
the operation again.
    + CategoryInfo          : InvalidArgument: (:) [Monitoring.ps1], PSArgumen
   tException
    + FullyQualifiedErrorId : Argument,abcd.ps1
PowershellWindows Server 2008

Avatar of undefined
Last Comment
Qlemo

8/22/2022 - Mon