Product, version and build: PS Studio 2022 Trial Version and PS Studio 2019
Operating system: Win 11
PowerShell version(s): 5.x.x
32-bit version of software? 64
Code below runs on Windows Powershell IDE but not on PS Studio 2022 or PS Studio 2019. $res is stucked "Loading value".
$comp = <'ip'>
$res = New-Object System.Net.NetworkInformation.Ping
$res.Send("$comp", 10000)
NET Calls not working on PS Studio
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NET Calls not working on PS Studio
A bit of a generalization in the title there. This is an asynchronous call. You need to turn on STA mode if you use those.
>> Running (pinger.ps1) Script... >> Platform: V7 64Bit (STA) >> Analyzing Script (Results in Tools Output panel)... Status : Success Address : 192.168.1.254 RoundtripTime : 4 Options : System.Net.NetworkInformation.PingOptions Buffer : {97, 98, 99, 100…} *** PowerShell Script finished. *** >> Execution time: < 1 second >> Script Ended
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: NET Calls not working on PS Studio
In my test V7 works whether STA or not. It does not work on V5 STA or not.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NET Calls not working on PS Studio
Seems to operate fine here:
>> Running (pinger.ps1) Script... >> Platform: V5 64Bit (STA) >> Analyzing Script (Results in Tools Output panel)... Name Value ---- ----- PSVersion 5.1.19041.2364 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.2364 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 Status : Success Address : 192.168.1.254 RoundtripTime : 1 Options : System.Net.NetworkInformation.PingOptions Buffer : {97, 98, 99, 100...} *** PowerShell Script finished. *** >> Execution time: < 1 second >> Script EndedThis is on Windows 10. Don't have a Win 11 machine here at the moment. I doubt it matters, but you never know.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: NET Calls not working on PS Studio
It is strange how this works on Win 11 Windows Powershell IDE 5.x. What PS Studio version are you testing on?
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NET Calls not working on PS Studio
5.8.213, the latest one released. I have also tested this in PrimalScript on Windows 11 by now and it has the same result.
There is something else at play I am afraid.
Please note that the ISE, PowerShell Studio, PrimalScript all use the same PowerShell. We are not having a private version.
There can be hosting differences when it comes to output, sure, but for that type of thing there should not be any difference from our end.
There is something else at play I am afraid.
Please note that the ISE, PowerShell Studio, PrimalScript all use the same PowerShell. We are not having a private version.
There can be hosting differences when it comes to output, sure, but for that type of thing there should not be any difference from our end.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NET Calls not working on PS Studio
Are you pinging an address outside your firewall?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: NET Calls not working on PS Studio
This is an isolated network no firewalls in between. Can you try SendPingAsync
(New-Object Net.NetworkInformation.Ping).SendPingAsync($IPAddr, 10000)
(New-Object Net.NetworkInformation.Ping).SendPingAsync($IPAddr, 10000)
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: NET Calls not working on PS Studio
Works like a charm
>> Running (pinger.ps1) Script... >> Platform: V5 64Bit (STA) >> Analyzing Script (Results in Tools Output panel)... Name Value ---- ----- PSVersion 5.1.19041.2364 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.2364 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 Result : System.Net.NetworkInformation.PingReply Id : 16 Exception : Status : RanToCompletion IsCanceled : False IsCompleted : True CreationOptions : None AsyncState : IsFaulted : False AsyncWaitHandle : System.Threading.ManualResetEvent CompletedSynchronously : False *** PowerShell Script finished. *** >> Execution time: 00:00:01 >> Script Ended
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: NET Calls not working on PS Studio
I am thinking about upgrading to Studio 5.8.213 but it had issues with SSH cmd prompt showing. Someone is looking into it but would be nice if that could be expedited here is the link to the post : viewtopic.php?t=16135