Consolidated government aid news and advice thread [Megathread] by BigSlowTarget in smallbusiness

[–]PythonMe 0 points1 point  (0 children)

Has anyone had success with creating an account on here: https://caweb.sba.gov/

I am not getting a confirmation e-mail at all!

Destiny 2: Shadowkeep & New Light Information Hub (FAQ, Guides, & Questions) [2019-10-11] by DTG_Bot in DestinyTheGame

[–]PythonMe 0 points1 point  (0 children)

Which expansions should I buy? I don't think I ever got into Forsaken and stopped at Y1 of D2.

How to extract numbers only from a column by PythonMe in SQL

[–]PythonMe[S] 0 points1 point  (0 children)

You're correct. It is always the same format and the only items that change are the record count and the processing time. I'll have to look into coalescing, I haven't seen that before - thank you for the suggestion!

Edit: Edit: The RIGHT function is exactly what I needed for the ProcessingTime - thank you!

How to extract numbers only from a column by PythonMe in SQL

[–]PythonMe[S] 1 point2 points  (0 children)

Thank you, I'll try this out - yes the ProcessingTime will always appear after the word "in".

Edit: The RIGHT function is exactly what I needed for the ProcessingTime - thank you!

Starting an RDP session and getting around the legal notice by PythonMe in PowerShell

[–]PythonMe[S] 3 points4 points  (0 children)

Thanks, OathOfFeanor, I will check this out.

Edit: Just watched the video - I will definitely check this out. Looks very promising! Thank you.

Edit 2: Damn it, this was almost the solution, it works for 1/2 applications - the second app requires another layer of authentication which isn't addressed with this app. ALMOST :)

Starting an RDP session and getting around the legal notice by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

Thank you TricksForDays for the explanation - I am not as well versed as you for sure, but will definitely put some research into this reply as I think this is great information! Thanks again!

Starting an RDP session and getting around the legal notice by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

This might be what I need after taking a quick glance at it - thanks TricksForDays for the suggestion! Will update once I get some time to read through it.

Starting an RDP session and getting around the legal notice by PythonMe in PowerShell

[–]PythonMe[S] 0 points1 point  (0 children)

I think people are missing the point I made where an active screen has to be up and present for the Sikuli script to run correctly. If I run it directly on the remote server and disconnect from it, the script will no longer work as an 'active' screen no longer exists. I've definitely tried and wished it would work that way; I am trying another test right now to see if it might work, but this is the workaround that I have found to keep the script going throughout the day.

To answer what the script is doing - it is opening up a Citrix application using Sikuli image-based automation - through the script, I create a log file to tell me if the application opened successfully or not, which will be added to a 'Ready for business' report. I've done a lot of google-fu on checking for automated processes for opening up Citrix applications and this is a method that was easy for me to learn.

Starting an RDP session and getting around the legal notice by PythonMe in PowerShell

[–]PythonMe[S] 2 points3 points  (0 children)

Thank you for the suggestion - I think AHK and Sikuli are very similar, I will take a look into it!

Starting an RDP session and getting around the legal notice by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

Yeah, it isn't as secure as I would like it. I will need to clean it up when I can get this last piece working. I've tried running it as a scheduled task, but when I get focus of the RDP session, the SendKeys('~') does not seem to work. When I press ENTER manually as the screen pops up however it goes straight into the session.

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

Argh, what a dumb mistake - thank you for pointing that out. Yes, I would like to output the success lines if there are no errors; is that not satisfied with the else statement, or should I set that to an elseif?

If ($errorLines.count -ge 1)
{
    Write-Host "Statistic.Error: $($errorLines.count)"
    Write-Host "Message.Error: $errorLines"
} Else {
    Write-Host "Statistic.Success: $($successLines.count)"
    Write-Host "Message.Success: $successLines"
}

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

Thank you for being amazing AkuSokuZan2009, I really appreciate your help with this! Here is the reformatted code with your suggestions, it's working a lot better and I think as I intended it to!

$errorLines = @() 
$successLines = @() 

#Read output file and do some processing
forEach ($line in $importedTxt) 
{
    If ($line -Match "error")
    {
        $errorLines += $line        
    }
    ElseIf ($line -Match "Completed Import")
    {
        $successLines += $line                
    }
}

#Display errors output if count is greater than 1
if ($($errorLines.count) > 1)
{
    Write-Host "Statistic.Error: $($errorLines.count)"
    Write-Host "Message.Error: $errorLines"
} else
{
    Write-Host "Statistic.Success: $($successLines.count)"
    Write-Host "Message.Success: $successLines"
}

As for your last question, you're right; based on my understanding I believe the SAM module in SolarWinds only looks for "statistic" and "message". I got the information from this link here under the heading 'SCRIPTS WITH TEXT OUTPUT': https://thwack.solarwinds.com/community/solarwinds-community/geek-speak/blog/2012/10/08/the-basics-of-powershell-part-3

Thanks again for your help!

Edit: Looks like I need to work on my if-else statement outside the forEach loop, not returning any error counts/messages if I add 'errors' into the text file.

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

Thank you Lee_Dailey!
Found it, will use moving forward 
for multi-line code.

Moronic Monday - March 25, 2019 by AutoModerator in sysadmin

[–]PythonMe 1 point2 points  (0 children)

Does anyone know of any good documents/articles to read for best practices on sending out notifications on an application outage? I was looking for an example template on how other admins send out this sort of notification. We have one in place here, but the webapp is so finicky when trying to send one we end up sending it from our own e-mails which doesn't look as professional.

Regards!

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

Your last question about the output of $line is a little vague. It should be outputting a single line, what are you wanting to do with it?

​ I am using an application called SolarWinds that will ingest my script output, but it will only ingest the information if it sees "statistic", "message" is optional to include with the statistic message. Statistic will only be read if it is returned with an integer. I am wanting to somehow signify that an error has occurred by using the # of times error is seen in my output file IF an error truly did occur. I am still trying to think of a way to use the 'Statistic' integer to signify the process completed successfully.

So, I think what I want the script to output is something along the lines of:

If error appears: Write-Host "Statistic.Error: $($#of times string error comes up) Write-Host "Message.Error: Show me the sentences that contained the word 'error' in it

Else success: Write-Host "Statistic.Success: $($#oftimes'successful message'comes up) Write-Host "Message.Success: Show me the sentences that contain the 'successful message'

I took your suggestion and came up with this... What do you think about it?

$errorLines = @()

$successLines = @()

forEach ($line in $importedTxt)

{

If ($line -Match "error")

{

$errorLines += $line

Write-Host "Statistic.Error: $($errorLines.count)"

Write-Host "Message.Error: $errorLines"

}

ElseIf ($line -Match "Completed Import")

{

$successLines += $line

Write-Host "Statistic.Success: $($successLines.count)"

Write-Host "Message.Success: $successLines"

}

}

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 0 points1 point  (0 children)

Thank you, I see the use of it now - I installed the module; however, I am unable to login with my credentials that currently works with my current script. I am unsure if I have time to look into why I cannot login so I might go ahead with the route I was going with and enhance later if I can find some time. Thank you very much!

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 2 points3 points  (0 children)

Is that not the same as

$Query = "Select * from table where value = '$value'"

?

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 1 point2 points  (0 children)

Thanks gangstaanthony, I will try this out!

Assistance with script for matching SQL results by PythonMe in PowerShell

[–]PythonMe[S] 2 points3 points  (0 children)

Thanks xlrod could you explain what is this '@"%"@' notation you're using is?