powershell

VS Code terminal history search, Windows, Powershell

人走茶凉 提交于 2021-01-29 09:29:38
问题 since version 1.43 the ctrl+r r keyboard shortcut has stopped working for powershell history searches. Is there another way to search in recently used commands? 回答1: I can't reproduce your issue. But you could try this keybinding in the meantime: { "key": "alt+r", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\u0012" } }, That sends a Ctrl + R to the terminal. Focus can be anywhere. That should trigger the reverse search of previous terminal commands. Does it do that

How to get line number of selected node in xml using powershell

ぐ巨炮叔叔 提交于 2021-01-29 09:16:04
问题 I would want to get the line number of node which is changed/manipulated in XML using powershell. $($node.LineNumber) doesn't seem to be working. For example: $node.ParentNode.InsertBefore($nodeToInsert, $node) //which inserts a node I want to get the line number of this node. 回答1: Lines and line numbers exist in the lexical XML that you supply as input to the XML parser. They don't exist (usually) in the tree of in-memory nodes that is output by the XML parser, and which your program is

How to get line number of selected node in xml using powershell

你离开我真会死。 提交于 2021-01-29 09:14:42
问题 I would want to get the line number of node which is changed/manipulated in XML using powershell. $($node.LineNumber) doesn't seem to be working. For example: $node.ParentNode.InsertBefore($nodeToInsert, $node) //which inserts a node I want to get the line number of this node. 回答1: Lines and line numbers exist in the lexical XML that you supply as input to the XML parser. They don't exist (usually) in the tree of in-memory nodes that is output by the XML parser, and which your program is

Enabling long file path in registry and gpedit.msc is not working

北城以北 提交于 2021-01-29 09:05:08
问题 I need to create folder with long file path more than 250 char using powershell cmd. I did the following things, 1, In this registry path "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem", I had changed the value for LongPathsEnabled as '1' 2,I have enabled long file path in "Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem >Enable Win32 long paths" (gpedit.msc) But while creating a folder with more than 250 char using power shell

Flatten a nested JSON with array and filter to CSV

佐手、 提交于 2021-01-29 09:00:44
问题 I got a question about How to use Powershell flatten a nested JSON and covert to CSV. Below is my JSON, which is a mail message log get from Office 365 with many users messages, I need to filter the columns, flatten and convert to CSV : createdDateTime, receivedDateTime, from_name from_adress To_name_1 To_adress_2 To_name_2 To_adress_2 ... The "from" field has only one data. But the "toRecipients" is a array. { ... "createdDateTime": "xxxx-xx-xx", "receivedDateTime": "xxxx-xx-xx", "isRead":

Power BI dataset refresh using Powershell

半城伤御伤魂 提交于 2021-01-29 08:52:10
问题 I've been using this powershell script to refresh the dataset in Power BI which was worked for me, but the problem was when I ran the script there was always a pop-up for me to login to my Power BI account. I really want to know if there's anyway to make the script auto login for me? Thank You script: https://github.com/Azure-Samples/powerbi-powershell/blob/master/manageRefresh.ps1 回答1: With the following you can easily get access the group info: $pbiUsername = "< USERNAME >" $pbiPassword = "

Add variable to Select-Object command in powershell and output to excel csv

懵懂的女人 提交于 2021-01-29 08:52:09
问题 I have a script that fetch user's manager info from a text file containing its respective groups and I want to put the results in an excel spreadsheet. Also, I'd like to add a custom variable to the Select-Objects command so it shows up as another column in excel with each user's respective group Here is what I have so far: $Properties = @( 'Title', 'Department', 'Manager' ) [string[]]$arrayFromFile = Get-Content -Path 'C:\sslvpn-active.txt' foreach($group in $arrayFromFile){ $searchb = "CN="

Catching paths of inaccessible folders from Get-Childitem

删除回忆录丶 提交于 2021-01-29 08:51:47
问题 I am working on small script to capture file hashes on a running system. I only have Powershell available. This is the active part of the code: get-childitem -path $path -filter $filename -Recurse -Force | Select FullName | foreach-object { get-filehash $_.fullname | select * } this is the command I am testing with: ./Get-FileHashesRecursive.ps1 -path c:\ -filename *.txt When running the script I get a series of errors because certain folders are inaccessible. I'd like to record the paths of

Dowload zip file from blob with SAS link using azcopy

a 夏天 提交于 2021-01-29 08:45:57
问题 I try to download a zip file from blob using the SAS link in powershell. I use the exact syntax as mentioned here but I get the below error failed to perform copy command due to error: cannot use directory as source without --recursive or a trailing wildcard (/*) Below is the script .\azcopy.exe copy '<SAS link to file>' '<local file path>' I use AzCopy version 10.3.3 回答1: Your linking article contains example commands that work with Azure Files . However, you mentioned you want to download a

Determine installed PowerShell version

ぐ巨炮叔叔 提交于 2021-01-29 08:30:36
问题 How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all? 回答1: Use $PSVersionTable.PSVersion to determine the engine version. If the variable does not exist, it is safe to assume the engine is version 1.0 . Note that $Host.Version and (Get-Host).Version are not reliable - they reflect the version of the host only, not the engine. PowerGUI, PowerShellPLUS, etc. are all hosting applications, and they will set the host's version to reflect