powershell

How can you select unique objects based on two properties of an object in powershell?

£可爱£侵袭症+ 提交于 2020-12-04 19:51:39
问题 I have an array of Objects that have 6 properties. That look like this: $csvData CURRENT DATE AND TIME : 07/10/2015 08:17:17 CST USER NAME : userName COMPUTER NAME : computerName IP ADDRESS : 192.168.1.1 LOGON SERVER : logonServer LOGON/OFF : logon I want to create an array of objects where username and computer name are not duplicated. How can I get only the unique username/computername combo in powershell? Ultimately I would like to remove all duplicates and add a property 'Count' that

FRP

痞子三分冷 提交于 2020-12-04 08:01:42
使用 FRP 反向代理实现 Windows 远程连接 互联网普及率的日渐攀升与 IPv4 资源的持续减少,现在大部分家庭宽带都不会分配公网 IP ,这使一些网络应用的实现多了些困难,像个人的 NAS 和一些智能家居设备。对于分配公网 IP ,各地运营商的态度也不同,有的去找客服反应可以要一个公网 IP ,还有些则直接告诉你每年多少钱。这些情况在 IPv6 普及之前都不会改善。 前几天看到了人民网的一条新闻: 阿里云联合三大运营商全面提供IPv6服务 。虽然现在网上有部分人对中国大力发展 IPv6 的目的持怀疑态度,认为是出于监管的目的,但我对此还是很支持的。首先我是很爱国的,按现在的话说叫“小粉红”,这是 精神层面 的原因。其次是 网络安全 问题,这是本届政府的战略思想, IPv4 的发展我们没赶上,资源都在美国佬手中,我们是受制于人的,虽说没像中兴一样。还有就是 互联网发展的势头太猛 ,中国是互联网大国,互联网+的国策一直推进,各种物联网设备激增,像工业数据采集和智能家居设备,这都需要大量的 IP 地址。 人民网北京6月21日电(记者孟哲)IPv6作为下一代互联网的技术基础,对物联网、车联网、人工智能等新兴产业的发展有着重大影响。昨日,阿里云宣布联合三大运营商全面对外提供IPv6服务,希望能在2025年前帮助中国互联网真正实现“IPv6 Only”。

How to return current item back to the pipeline?

北城以北 提交于 2020-12-04 05:15:44
问题 Im currently importing csv files and bulk loading to sql table. using this code $CSVDataTable = Import-Csv $csvFile | % -begin {$i=0} -process { Write-Progress -activity "Importing file" -currentOperation "Reading line $i" -PercentComplete -1; $i++; return $_ } | Out-DataTable i am able to show the progress, but I'd like to optimize it and one recommendation Ive found is utilizing StreamReader. so ive tried the following: [int]$LinesInFile = 0 $reader = New-Object IO.StreamReader $csvFile

How to return current item back to the pipeline?

99封情书 提交于 2020-12-04 05:11:58
问题 Im currently importing csv files and bulk loading to sql table. using this code $CSVDataTable = Import-Csv $csvFile | % -begin {$i=0} -process { Write-Progress -activity "Importing file" -currentOperation "Reading line $i" -PercentComplete -1; $i++; return $_ } | Out-DataTable i am able to show the progress, but I'd like to optimize it and one recommendation Ive found is utilizing StreamReader. so ive tried the following: [int]$LinesInFile = 0 $reader = New-Object IO.StreamReader $csvFile

Is there a way to escape quotes in ripgrep for MS Windows (Powershell or CMD)?

橙三吉。 提交于 2020-12-03 09:50:33
问题 I want to find a string "Hello (Hello starts with double quote) in text files using ripgrep . Normally, in Bash or ZSH, this would work by escaping with backslash or surrounding with single quote: rg \"Hello rg '"Hello' However, in MS Windows (Powershell and CMD), I've tried these but none of these worked: rg \"Hello rg '"Hello' rg `"Hello rg '`"Hello' Is there any way to escape single or double quotes using ripgrep in MS Windows? 回答1: Verbatim string "Hello must ultimately be passed as \

Is there a way to escape quotes in ripgrep for MS Windows (Powershell or CMD)?

戏子无情 提交于 2020-12-03 09:49:39
问题 I want to find a string "Hello (Hello starts with double quote) in text files using ripgrep . Normally, in Bash or ZSH, this would work by escaping with backslash or surrounding with single quote: rg \"Hello rg '"Hello' However, in MS Windows (Powershell and CMD), I've tried these but none of these worked: rg \"Hello rg '"Hello' rg `"Hello rg '`"Hello' Is there any way to escape single or double quotes using ripgrep in MS Windows? 回答1: Verbatim string "Hello must ultimately be passed as \

Is there a way to escape quotes in ripgrep for MS Windows (Powershell or CMD)?

雨燕双飞 提交于 2020-12-03 09:49:32
问题 I want to find a string "Hello (Hello starts with double quote) in text files using ripgrep . Normally, in Bash or ZSH, this would work by escaping with backslash or surrounding with single quote: rg \"Hello rg '"Hello' However, in MS Windows (Powershell and CMD), I've tried these but none of these worked: rg \"Hello rg '"Hello' rg `"Hello rg '`"Hello' Is there any way to escape single or double quotes using ripgrep in MS Windows? 回答1: Verbatim string "Hello must ultimately be passed as \

PSexec copyright output

怎甘沉沦 提交于 2020-12-02 08:25:54
问题 Does anyone know, how to disable "copyright header" from appearing when running PSExec? Everutime I run "./psexec ..." command I see this message: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com It's really annoying and it bloats up output of my script. Thanks Matthew 回答1: There does not appear to be a way to disable it from occurring, but as a workaround you could redirect STDERR which will suppress the output, psexec \

PSexec copyright output

假如想象 提交于 2020-12-02 08:24:04
问题 Does anyone know, how to disable "copyright header" from appearing when running PSExec? Everutime I run "./psexec ..." command I see this message: PsExec v2.11 - Execute processes remotely Copyright (C) 2001-2014 Mark Russinovich Sysinternals - www.sysinternals.com It's really annoying and it bloats up output of my script. Thanks Matthew 回答1: There does not appear to be a way to disable it from occurring, but as a workaround you could redirect STDERR which will suppress the output, psexec \

Access PSObject property by name in C#

一世执手 提交于 2020-12-02 06:00:49
问题 For example I have a PSObject transaction with two properties: id and transactionName , so that it looks like: transaction { id: 123 transactionName : tranName1 } and I want to return the id of the transaction if its name is tranName1. It looks to me that in powershell scripts, we can simply do: if $transaction.transactionName -eq tranName return $transaction.id however in c# it will give error since it cannot recognize the property by name... any ideas how to do it in c#? 回答1: Try something