powershell

Powershell Count lines extremely large file

浪子不回头ぞ 提交于 2020-12-29 18:17:40
问题 I have a extremely large text file of size 250 GB that's given to us by a vendor. They also give us a control file that is supposed to have the number of lines in the large file. Sometimes there is a mismatch. How do I count lines in Powershell? I tried this command and it ran for more than half hour and was not done yet. Get-content C:\test.txt | Measure-Object –Line (gc C:\test.txt | Measure-object | select count).count Any help is appreciated Thanks MR 回答1: If performance matters, avoid

朝鲜黑客组织 Kimsuky 的持续性网络攻击

ε祈祈猫儿з 提交于 2020-12-29 17:04:26
作者:知道创宇404实验室翻译组 原文链接: https://us-cert.cisa.gov/ncas/alerts/aa20-301a 一、概要 网络安全报告书由网络安全基础设施安全局(CISA)、联邦调查局(FBI)和美国网络司令部国家宣教部队(CNMF)联合撰写,主要描述了针对朝鲜高级黑客组织 Kimsuky 网络攻击所使用的战术、技术和程序(TTP)。美国政府将该网络攻击称为HIDDEN COBRA,有关HIDDEN COBRA的更多信息,请访问 https://www.us-cert.cisa.gov/northkorea 。 本文描述了截止2020年7月已知的Kimsuky黑客网络攻击事件,旨在保护相关组织免受该黑客影响。 单击此处 以获取PDF版本。 二、主要发现 Kimsuky黑客组织可能自2012年开始运营。 Kimsuky很可能是朝鲜政府支持的全球情报搜集任务。 Kimsuky运用常见的策略窃取数据。[ 1 ],[ 2 ] Kimsuky最可能使用网络钓鱼获取初始访问权限。[ 3 ] Kimsuky的情报收集针对韩国、日本和美国。 Kimsuky重点关注朝鲜半岛、核政策、外交政策及国家安全问题的相关信息。 Kimsuky特别关注对象: 各领域专家、智囊团、韩国政府机关;[ 4 ],[ 5 ],[ 6 ],[ 7 ],[ 8 ] CISA

What is the correct encoding for PS1 files

早过忘川 提交于 2020-12-29 13:16:24
问题 I am doing some text stream processing on a series of PS1 & PSM1 files, and I ran into some issues with smart quotes and em-dashes (never, NEVER, cut and paste code from MS Scripting Guy blog). I figured the issue was encoding so I looked, and I have files of both ASCII & UTF8, but of course both have issues with my funky text. So I have done some replacements, and I have that working, but I wonder if I shouldn't also standardize on one encoding, and if so, which one? 回答1: Not a direct answer

What is the correct encoding for PS1 files

爷,独闯天下 提交于 2020-12-29 13:13:00
问题 I am doing some text stream processing on a series of PS1 & PSM1 files, and I ran into some issues with smart quotes and em-dashes (never, NEVER, cut and paste code from MS Scripting Guy blog). I figured the issue was encoding so I looked, and I have files of both ASCII & UTF8, but of course both have issues with my funky text. So I have done some replacements, and I have that working, but I wonder if I shouldn't also standardize on one encoding, and if so, which one? 回答1: Not a direct answer

What is the correct encoding for PS1 files

橙三吉。 提交于 2020-12-29 13:12:03
问题 I am doing some text stream processing on a series of PS1 & PSM1 files, and I ran into some issues with smart quotes and em-dashes (never, NEVER, cut and paste code from MS Scripting Guy blog). I figured the issue was encoding so I looked, and I have files of both ASCII & UTF8, but of course both have issues with my funky text. So I have done some replacements, and I have that working, but I wonder if I shouldn't also standardize on one encoding, and if so, which one? 回答1: Not a direct answer

Where-object $_ matches multiple criterias

南笙酒味 提交于 2020-12-29 13:10:42
问题 $data|where-object{$_.Name -eq "$serverName.domain.com"}|select-object -Property Description1, Version | where-object{$_.Description1 -match "bnx2x" -or "be2net"} | %{"{0}" -f $_.Version} So I'm trying to get the version number. However, the Description1 can have two names that I want to look for. I've gotten my code to work for just matching one string but I cant seem to find the right syntax to match multiple strings with an "-or" 回答1: This should do what you want, and is a bit shorter than

Where-object $_ matches multiple criterias

两盒软妹~` 提交于 2020-12-29 13:06:47
问题 $data|where-object{$_.Name -eq "$serverName.domain.com"}|select-object -Property Description1, Version | where-object{$_.Description1 -match "bnx2x" -or "be2net"} | %{"{0}" -f $_.Version} So I'm trying to get the version number. However, the Description1 can have two names that I want to look for. I've gotten my code to work for just matching one string but I cant seem to find the right syntax to match multiple strings with an "-or" 回答1: This should do what you want, and is a bit shorter than

Conda not activate in Power Shell

一个人想着一个人 提交于 2020-12-29 12:58:17
问题 I have already install anaconda on my Windows 10 laptop. I'm trying to activate the Python environment named pyenv . First, I check the conda env list in my laptop, this is the output on the power shell: PS C:\Users\User> conda env list # conda environments: # base * C:\Users\User\Anaconda3 pyenv C:\Users\User\Anaconda3\envs\pyenv Then I activate pyenv : PS C:\Users\User> conda activate pyenv But I check again, it still activates base environment: PS C:\Users\User> conda env list # conda

Copy a list of files to a directory

 ̄綄美尐妖づ 提交于 2020-12-29 03:06:32
问题 There is a folder that contains a lot of files. Only some of the files needs to be copied to a different folder. There is a list that contains the files that need to be copied. I tried to use copy-item, but because the target subfolder does not exist an exception gets thrown "could not find a part of the path” Is there an easy way to fix this? $targetFolderName = "C:\temp\source" $sourceFolderName = "C:\temp\target" $imagesList = ( "C:\temp\source/en/headers/test1.png", "C:\temp\source/fr

Copy a list of files to a directory

浪子不回头ぞ 提交于 2020-12-29 03:05:42
问题 There is a folder that contains a lot of files. Only some of the files needs to be copied to a different folder. There is a list that contains the files that need to be copied. I tried to use copy-item, but because the target subfolder does not exist an exception gets thrown "could not find a part of the path” Is there an easy way to fix this? $targetFolderName = "C:\temp\source" $sourceFolderName = "C:\temp\target" $imagesList = ( "C:\temp\source/en/headers/test1.png", "C:\temp\source/fr