Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 03:36
    jborean93 commented #15109
  • 03:35
    jborean93 commented #15109
  • 03:19
    iSazonov commented #15109
  • Apr 18 23:58
    Nahuatl-Mexica commented #3048
  • Apr 18 21:39
    mklement0 commented #15259
  • Apr 18 20:29
    mklement0 commented #15250
  • Apr 18 19:45
    conioh commented #15247
  • Apr 18 19:38
    unfurl-links[bot] commented #15247
  • Apr 18 19:38
    conioh commented #15247
  • Apr 18 19:24
    mklement0 commented #15259
  • Apr 18 19:06
    mklement0 commented #15259
  • Apr 18 18:31
    SteveL-MSFT edited #15264
  • Apr 18 18:28
    DHowett commented #15109
  • Apr 18 18:25
    mklement0 commented #15257
  • Apr 18 18:24
    mklement0 commented #15257
  • Apr 18 18:01
    iSazonov commented #15257
  • Apr 18 17:58
    iSazonov commented #15259
  • Apr 18 17:54
    mklement0 commented #15250
  • Apr 18 17:50
    mklement0 commented #15257
  • Apr 18 17:42
    mklement0 commented #15250
zygon.sisyphus
@zygon.sisyphus:matrix.org
[m]
Hi
Lokeswararao
@Lokeswararao
Anyone have idea on codecoverage using powershell
1 reply
Christoph Loy
@beatbrot
Hey guys. Is there a way to disable powershells update check?
ngetchell
@ngetchell:matrix.org
[m]
@beatbrot did you try opening powershell.exe with the /nologo argument?
zygon.sisyphus
@zygon.sisyphus:matrix.org
[m]
hi, is possile to compile powershell with corert or nativeAot ?
Celmor
@Celmor:matrix.org
[m]
How should I pass arguments to a powershell script that I call via powershell.exe -file -arg1 "'my argument'"? do I need to double quote the args? I'm invoking this from another application, so no shell
Joel Sallow (/u/ta11ow)
@vexx32
as far as I know you shouldn't need to double quote the arguments
Celmor
@Celmor:matrix.org
[m]
if I run my powershell invocation without quotes args and spaces within them my script doesn't work properly
Celmor
@Celmor:matrix.org
[m]
it seems occasionally my PS terminal doesn't close after running my script where it prints the result of the last command ("stop-transcript") but then just stays open with the caller seemingly waiting around for it to exit. is there any way to find out where PS hangs?
maybe on some sub-process it opened? (it opened an excel process)
CodeUnstable
@CodeUnstable
Is there any way I can create a sort-of CLI tool with commands using power shell? If so, how? Cuz I have no idea 🤷‍♂️.
Konstantin Mokhnatkin
@lacostya86

Is there any way I can create a sort-of CLI tool with commands using power shell? If so, how? Cuz I have no idea 🤷‍♂️.

It seems to me the only way is to create your own module with all required functions-"cli arguments".

Mochtar van de Griendt
@Aprazeth
@CodeUnstable As @lacostya86 pointed out, you'll need to load in or access the necessary API/endpoints/framework via a cmdlet or module yourself. If it's NET Framework based it can be relatively easy (See for example making SharePoint 2007 accessible in PowerShell) But if it's another API it might become a tad more complicated. You'll have to check with the vendor of whatever you wish to access via the CLI what they support/offer. You might find they already have a module or CLI available (like AWS, VMware etc.)
Celmor
@Celmor:matrix.org
[m]
has anyone been able to login on an sshd server (on windows) using the OpenSSHUtils (or is that module no longer needed)? According to the guide I need Repair-AuthorizedKeyPermission from that module but I can't install it
CodeUnstable
@CodeUnstable
@Aprazeth and @lacostya86, I am wanting to make a cross-platform CLI-Tool for compiling my WIP JVM language Cylvre (https://github.com/Cylvre-Language/Cylvre). As it is Java API, It could get a tad bit hard to make the tool.
S1m1B1lly
@S1m1B1lly
Is there a way to change the startup text, the copyrigt text or put my own text under it? like a figlet?
Celmor
@Celmor:matrix.org
[m]
@S1m1B1lly: powershell.exe -NoLogo hides it. you can print a custom message via commands in startup script (see $profile)
Ben Johnson
@cbj4074
image.png
Just received this randomly.
Don't recall updating anyting explicitly... maybe some Windows Update was installed on schedule or whatever, but that's super annoying. Things worked 8 hours ago, and now they're broken.
Installled version: N/A ... not helpful.
Ben Johnson
@cbj4074
I should add that upgrading to Powershell Core 7 doesn't help. I love many aspects of Powershell, but the lack of right hand talking to left hand is problematic.
Mochtar van de Griendt
@Aprazeth
@cbj4074 the fact that it can't detect which version is installed sounds, to me at least, as if there is something wrong with that script and not powershell. Have you tried checking it via $psversiontable ? If that reports PSVersion 7.x.x or 5.x.x (depending on which version you run it under of course) everything is working correctly on that end.
Mavaddat Javid
@mavaddat

hi PowerShellers, I was wondering about opening an issue on the PS repo to suggest that -ErrorAction allow for ScriptBlock data (system.management.automation.scriptblock). E.g., this one-liner to get a service and restart it with the catch action of setting the service startup type to manual in case of failure:

Get-Service *nord* | Restart-Service -Force -ErrorAction {$_ | Set-Service -StartupType manual; $_ | Restart-Service -Force}

Is this a bad idea (to make the issue to suggest this feature)? I am asking because the suggestion basically shortcuts the entire try-catch approach of C# and perhaps this is not even considerable.

Mochtar van de Griendt
@Aprazeth
@mavaddat Interesting point - and please note that this is my personal honest (and probably biased) opinion, but I'd suggest against it. The reasoning being that in PowerShell the general course is to filter first beforehand. In your example I'd wager that the reason you got the error from Restart-Service first is because some services were set tot disabled. The generally recommended recourse, and that's AFAIK in every language the case, is to check for any potential issues first, address those, and then take action. AKA Check twice, cut once. All of this said, it is a very interesting point you bring forward :)
Mavaddat Javid
@mavaddat
@Aprazeth I think you're right. I think the point of ErrorActionis not to provide the script that will occur in case of the error, but rather how the particular cmdlet itself will announce in case its produces an error. It's like the difference between a smoke alarm and a fire extinguisher. The latter is the tool that will be used in case of fire, but the former is how the fire itself is announced.
Kevin Crook
@kwcrook
Is Powershell EXO v2 really the only way to manage Exchange Online (other than the UI)?
I see people spinning up IIS + C# stacks to connect to it with Powershell... is there no API to add transport rules without using powershell cmdlets?
Mochtar van de Griendt
@Aprazeth
@kwcrook - you might get a better/more insightfull response with that question in the Exchange community, as the PowerShell community doesn't do anything per se with Exchange (as the Exchange team themselves are responsible for implementing their PowerShell APi and cmdlets) That said, speaking from my experience with SharePoint (yeay) I wouldn't be surprised if EOL was indeed using PSv2 still.
@kwcrook and a quick cursory search later: https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module - the module is version 2 not the required PowerShell version. It is officially supported on newer versions, and I quote "Specifically, version 2.0.4 or later of the EXO V2 module is supported in PowerShell 7.0.3 or later."
yuvaraj151089
@yuvaraj151089
Hi
Hello All,
I am working on. Powershell script to pull data from laptop.
1.Version of Adobe Connect and Zoom in device
2.When we intiate Adobe connect and Zoom Mic and camera drivers are initiated?
I am looking for a output to be displayed in page.
Help required is, how to display in page? I can create individual lines for each output but unable to get single display. Any help will be highly appreciated
Morgan Overman
@Smorgan05
I mean you could use wmi or pull from the install directory for Adobe Connect.
I'm gonna hazard a guess that you are doing this across an entierprise env
yuvaraj151089
@yuvaraj151089
yes, for larger environment
is there any wmi scripts available?
MikeR
@mikerossiter
I had a script to check version of Chrome across a large site on individual machines. Is that the kind of thing you mean?
yuvaraj151089
@yuvaraj151089
I want to send a link to user, and when user clicks the link, the script should be get user's Adobe connect and Zoom software version. Along with Mic and Camera of the Device is working or not. If user didn't have latest's version of software, there should be a update button which should get latest version of software from our software center.
Morgan Overman
@Smorgan05
@yuvaraj151089 That's called a group policy / SCCM. I would talk with your enterprise IT guys.
Mochtar van de Griendt
@Aprazeth
@yuvaraj151089 I'll second what @Smorgan05 is saying. In that case you'll want to use something along the lines of SCCM or other comparable products. You could do it with PowerShell but that is way way way more work initially and in the long term to support etc. compared to using something like SCCM
Morgan Overman
@Smorgan05
Also, here's the big problem with this across the enterprise the devices will vary. IT already knows what's on the network (domain) so that this can be deployed in a stable manner. Were I you I would tell them "hey I need the newest version of adobe connect and Zoom deployed across all devices on the network". If you tell them hey dog there's an MSI version they will love you. Also if you have an amazing enterprise IT dept they will be able to pull the event logs to ensure the Mic and Camera is working. The alternative is the scream test where the users check this by having a mandatory test meeting on zoom. (Takes my pretend IT hat off)
Morgan Overman
@Smorgan05
Also generally speaking install checking for Windows is terrible. Microsoft does not enforce standards and all the control panel is doing is pulling the program name, version number, and statically linking based on a static path in the registry. Also if you try to build a script by checking the program install folder won't work because the publisher may change means by which they deploy (appdata). This is the path of darkness.
Mochtar van de Griendt
@Aprazeth
Darkness being a nice way of saying insanity.
MikeR
@mikerossiter
In my experience you wouldn’t tell the end user to update (but I’m sure you have good reason to do that) but you would push the update out via group policy. The user would be none the wiser!
Morgan Overman
@Smorgan05
There are a few options but that's getting pedantic. shrugs
gravspeed
@gravspeed:matrix.org
[m]
so i'm trying to make a visual basic app using some powershell commands, but whenever i try to add the powershell package it tells me "Package 'PowerShell 7.1.3' has a package type 'DotnetTool' that is not supported by project 'ConsoleApp3'."
i suspect i'm doing something wrong....
what kind of projects are supported by "dotnettool" google is not being helpful
Morgan Overman
@Smorgan05
In general I do not recommend invoking powershell with C# there are native commands that one can use in C#.
Joel Sallow (/u/ta11ow)
@vexx32
You must be pulling in the wrong package from NuGet. The dotnet tool is only usable as a command line tool (dotnet tool install powershell) -- you'd want the SDK package, I think?
12annumishra17
@12annumishra17
Hey Team,
I've a powershell code which works fine with all the data execution. The issue comes when I leave a field blank in excel, it says you cannot call a null valued expression. Any help?