question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return empty string

See original GitHub issue

I have a question and maybe you can help.

I’m trying to remotely get the PowerShell version on the host, if i run the command locally in powershell it works. But if i run it remotely using pypsrp, I get an empty string. Any idea why ?

Locally : (Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine’).PowerShellVersion Returns : 5.1.14393.0

In Python : ps.add_script("(Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine’).PowerShellVersion") print(ps.invoke[0])` Returns : “”

If i get the windows version instead of PowerShellVersion (different reg path) it works.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lesourcilcommented, Dec 14, 2020

Works like a charm adding “r” in front of all strings… Thx again

On Sun, Dec 13, 2020 at 6:06 PM leSourCil lesourcil@gmail.com wrote:

Yup That was the plan put r in front of all strings On Dec. 13, 2020, at 18:03, Jordan Borean notifications@github.com wrote:

It’s because of the \3 in the path, you can see in the error it became � (your console might show something else) meaning it’s an invalid char. Other characters can do the same thing and it also depends on whether they are capitalised or not. The best way to avoid this IMO is to just have your start be an r-string like r"my script" as you don’t need to escape the backslashes.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jborean93/pypsrp/issues/97#issuecomment-744083791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHORAF7J6SNAXWYDQM6MRYLSUVB2LANCNFSM4UXCX4VQ .

Sach

0reactions
lesourcilcommented, Dec 13, 2020

Yup That was the plan put r in front of all strings

On Dec. 13, 2020, 18:03, at 18:03, Jordan Borean notifications@github.com wrote:

It’s because of the \3 in the path, you can see in the error it became (your console might show something else) meaning it’s an invalid char. Other characters can do the same thing and it also depends on whether they are capitalised or not. The best way to avoid this IMO is to just have your start be an r-string like r"my script" as you don’t need to escape the backslashes.

– You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jborean93/pypsrp/issues/97#issuecomment-744083791

Read more comments on GitHub >

github_iconTop Results From Across the Web

Returning an empty string : efficient way in c++ - Stack Overflow
Show activity on this post. I have 2 ways of returning an empty string from a function.
Read more >
return_empty_string() | Function
Returns an empty string.
Read more >
Return empty String for null string - Java java.lang - Java2s.com
Description. Return empty String for null string. Demo Code. public class Main { public static void main(String[] argv) { String s = "java2s.com"; ......
Read more >
JavaScript Check Empty String – Checking Null or Empty in JS
We now know that an empty string is one that contains no characters. It is very simple to check if a string is...
Read more >
How to Check if a String is Empty in Python - Datagy
In this section, you'll learn how to check if a string is both empty as well as blank, meaning that it only contains...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found