by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 05:12
    vexx32 synchronize #12495
  • 05:11
    iSazonov labeled #13381
  • 05:10
    iSazonov commented #13381
  • 05:08
    iSazonov labeled #13380
  • 04:57
    iSazonov closed #13391
  • 04:56
    iSazonov labeled #13385
  • 04:56
    iSazonov commented #13385
  • 04:55
    iSazonov edited #13385
  • 04:07

    iSazonov on master

    Use 'is' operator instead of 'a… (compare)

  • 04:07
    iSazonov closed #13287
  • 04:06
    iSazonov milestoned #13287
  • 04:06
    iSazonov assigned #13287
  • 04:06
    iSazonov unassigned #13287
  • 04:04
    vexx32 synchronize #12495
  • 04:03
    iSazonov commented #13359
  • 03:57
    vexx32 synchronize #12495
  • 03:53
    iSazonov labeled #13387
  • 03:52
    vexx32 synchronize #9900
  • 03:49
    iSazonov commented #13305
  • 03:45
    sdwheeler commented #13162
Arxher Chang
@GrandArth
I tired to slove this via Win10 region setting by enabling UTF-8 support but it didn't slove the issue.
Would anyone kindly provide some advice? Thx in advance.
Arxher Chang
@GrandArth
And then i found this post:https://stackoverflow.com/questions/35573209/how-to-configure-the-encoding-for-powershell-console
and after [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 everything works just fine
Mochtar van de Griendt
@Aprazeth
@GrandArth Thanks for sharing the solution, and glad to hear you got it working :) Have a great day!
Arxher Chang
@GrandArth

Greetings. Would anyone kindly help with a linux related issue?
Yesterday, i rewrote a zsh script into powershell and i did it in the form of a function.
So there is a function xxxxx(){} in my user profile which is in /home/arxher/config/powershell/Microsoft.PowerShell_profile.ps1. I would like to use crontab to set a schedule on this function, so i wrote like pwsh -Command {TBTblocklist} (TBTblocklist is the name of the function), but i got nothing in the >> redirection log file after a while.

16 */2 * * * * arxher pwsh -File "/home/arxher/FunctionCaller.ps1" >> /home/arxher/pwshautolog

I tried to use a ps1 file containing only one line of the name of the function but this did not work either.

I wonder what is the right way to do this? I am using release 7.0.3 for linux arm 64 and there is a soft link in /usr/bin, thx in advance.

Arxher Chang
@GrandArth
Ok i sloved it... it turn out to be another AB and Y question... the log file for some reason is readonly... that's way i didn't get any output XD. Sorry for the disruption.
Christopher Yeleighton
@yecril71pl
Start-PSBuild requires git but it is not documented anywhere.
All I get is: C:\Users\User\Documents\GitHub\PowerShell\PowerShell.Common.props(17,5): error MSB3073: The command "git describe --abbrev=60 --long" exited with code 9009.
That does not even say that PS did not find my git.
Mochtar van de Griendt
@Aprazeth
Assuming you're referring to build PS itself; the documentation does stipulate that. See for example for the Windows one: https://github.com/PowerShell/PowerShell/blob/fde00de77f48f4bd2eede46dc3ed4a812da0c2d6/docs/building/windows-core.md
That said, I do agree that the error-message could be more clear ("Git is not installed or detected" or something)
djwork
@djwork

How are we supposed to raise/escalate errors or missing features that are surfaced by PowerShell but are actually caused by errors or missing features in underlying Windows components? For example PowerShell/JEA#30 is a bug where defining a JEA endpoint via DSC causes WinRM to hang. The bug appears to be in WinRM but how do I escalate it or route it to the right place?

Another example is the is no API for setting service recovery options, we can rap SC.exe but that is it, is there away to propose / vote for API extensions with the Windows team?

matrixbot
@matrixbot
Celmor I'm kind of surprised that compress-archive embeds the path into the file name. When extracting on Linux (using some generic unzipper) I get the path separator ("\") embedded in the filenames...
Joel Sallow (/u/ta11ow)
@vexx32
@Celmor you might wanna submit that as an issue on the Microsoft.PowerShell.Archive repo, I know someone has been working on a thorough rewrite of it, and it might be good for them to keep that in mind as they do that
matrixbot
@matrixbot
Celmor Joel Sallow (/u/ta11ow) (Gitter): PowerShell/Microsoft.PowerShell.Archive#48
Brent Arias
@brentarias

Is there a way, in either a CMD or PS prompt, to say something like this:

copy **\foo\bar\*hello.txt .

In other words, recursively search for a particular folder pattern...and copy all the files from that pattern to another directory?

Morgan Overman
@Smorgan05
@brentarias
$List = gci -Recurse -Directory | Where-Object {$_ -match "Pattern"} | select FullName
foreach ($item in $List){ Copy-item -Source $item -Destination "DestHere"}
Brent Arias
@brentarias
@Smorgan05 ...that doesn't seem to work. The $List variable always has $List.Count equal to zero.
Morgan Overman
@Smorgan05
$List = gci <path here> -Recurse -Directory | Where-Object {$_ -match "Pattern"} | select FullName
foreach ($item in $List){ Copy-item -Source $item -Destination "DestHere"}
Brent Arias
@brentarias
I'm trying -match "\foo\bar\*hello.txt" and nothing. If I prefix the match with an asterisk, then I get a ton of errors.
Nothing I supply for a "match" works. Doesn't matter if I use wildcards or an exact filename.
Brent Arias
@brentarias
I figured it out! The -Directory switch must be removed, and then it can find the files!
Brent Arias
@brentarias
When I'm in a CMD prompt and I issue a powershell -command "..." statement, how do I make that work for what normally would be a multi-lines of powershell commands? I don't want to make a script...I just need to issue two Powershell commands (in the same subshell). So how do I indicate a line termination between the two commands?
...oh wait, I think it might be just a semicolon I need. Checking...
Brent Arias
@brentarias
Yup, that did it!
matrixbot
@matrixbot
nod0n Hi, currently I starting a rdp session and then I do start a powershell on remote servers. I would like to avoid having to start a rdp session. I do have powershell 7.0.3 install on my Ubuntu 18.04. I tried to New-PSSession 1.2.3.4 -Credential user and got the error: New-PSSession: MI_RESULT_ACCESS_DENIED. My password is correct, I use it to connect with RDP... What can be wrong?
Mochtar van de Griendt
@Aprazeth
@matrixbot nod0n did you enable remote powershell access? Have a look at https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core?view=powershell-7 and/or https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/wsman-remoting-in-powershell-core?view=powershell-7. Please note you'll need to enable PS remoting on the server - not on the client :)
matrixbot
@matrixbot
nod0n Mochtar van de Griendt (Gitter): I will check.
nod0n thx
12annumishra17
@12annumishra17
Hi all
Require a help in powershell
Now we are getting values like this
$collresult= abc|def
$sugresult = ghi| jkl
Now what i am trying to do is map it up like this
Abc->ghi
def-> jkl
And store in one variable final all the output after mapping
$collId =@()
$SUGName = @()
baosj0
@baosj0
does anybody build powershell successfully with visualstudio2019?
baosj0
@baosj0
xtqqczze Use is not syntax where appropriate and remove unnecessary parentheses (#13323) this usage makes my build failed!!!!!!!
baosj0
@baosj0
oh that is a new c# syntax, my vs doesnt recognize it.. so i back to a earlier commit, finally success..

git clone <powershell git>
cd powershell
git checkout 5abcd58

import-module ./build.psm1
start-psbuild -clean

then open vs, add project "Microsoft.PowerShell.GraphicalHost", then build, all success

Christopher Yeleighton
@yecril71pl
Short of stracing, how can I discover where Update-Help installs stuff?
Sean Wheeler
@sdwheeler
@yecril71pl This is covered in about_Updateable_Help. The help files are installed in a language subfolder (en-US) of the module.
Christopher Yeleighton
@yecril71pl
It turns out, they are not. Update-Help basically does not even try on Linux. @iSazonov ?
https://github.com/PowerShell/PowerShell/issues/10671#issuecomment-668692847
Joel Sallow (/u/ta11ow)
@vexx32
you probably need to check your culture settings
iirc some linux distro culture settings are a bit odd
Try with Update-Help -UICulture en-us
Christopher Yeleighton
@yecril71pl
I tried, no difference there.
12annumishra17
@12annumishra17
Can we mail the content of out file??
$queryoutput |Out-File "abc.csv"
How can we email this file as an attachment?
Sean Wheeler
@sdwheeler
@vexx32 Update-Help is case-sensitive you should try Update-Help -UICulture en-US
Joel Sallow (/u/ta11ow)
@vexx32
that seems... like a bug, given PowerShell's general stance on case sensitivity
Sean Wheeler
@sdwheeler
Agreed. It is problematic. This issue is more that the file system serving the updateable help files is case sensitive. Update-Help build the filename of the content to be downloaded. On Windows, the API for culture return a mixed-case string (en-US). On non-Windows, there is no API and no guarantee that you will get a correctly cased value. If the filesystem on the download server was not case sensitive, it would not matter as much. But we can't change that.