powershell

PowerShell string interpolation syntax

眉间皱痕 提交于 2020-12-05 11:54:05
问题 I always used the following syntax to be sure that variable were expanded in a string: "my string with a $($variable)" I recently ran into the following syntax: "my string with a ${variable}" Are they equivalent? Any difference? 回答1: To complement marsze's helpful answer: ${...} (enclosing the variable name in { and } ) is indeed always necessary if a variable name contains special characters (such as spaces or . ) In the context of string expansion (interpolation) inside "..." , there is

how to run powershell script through excel VBA

半世苍凉 提交于 2020-12-05 11:40:57
问题 I am trying to use an Excel VBA macro to launch a PowerShell script if a certain condition is met. I'm not getting any errors in the code when it runs and I am able to manually run the PowerShell script from the Windows Explorer window without errors. However, when I execute the below VBA code, the PowerShell does not run and I am not sure why. Dim x as Variant If rs.RecordCount = 0 Then x = Shell("POWERSHELL.exe " & "H:\MyFolder\MyFile.ps1", 1) End If I can't tell if something in the VBA

how to run powershell script through excel VBA

不想你离开。 提交于 2020-12-05 11:36:07
问题 I am trying to use an Excel VBA macro to launch a PowerShell script if a certain condition is met. I'm not getting any errors in the code when it runs and I am able to manually run the PowerShell script from the Windows Explorer window without errors. However, when I execute the below VBA code, the PowerShell does not run and I am not sure why. Dim x as Variant If rs.RecordCount = 0 Then x = Shell("POWERSHELL.exe " & "H:\MyFolder\MyFile.ps1", 1) End If I can't tell if something in the VBA

小心!基于UEFI引导的病毒,重装系统也清除不了

孤者浪人 提交于 2020-12-05 11:08:13
TrickBot是世界上最臭名昭著且适应性最强的恶意软件,它正在扩展其工具集,以将目光投向固件漏洞,以潜在地部署Bootkit并完全控制受感染的系统。 它利用易于使用的工具来检查设备是否存在众所周知的漏洞,这些漏洞可能使攻击者将恶意代码注入设备的UEFI / BIOS固件中,攻击者持久存储恶意软件的有效机制,从而重装系统也清除不了。 国际知名白帽黑客、东方联盟创始人郭盛华透露:“这标志着TrickBot的发展迈出了重要的一步,因为UEFI级植入物是最深,最强大,最隐蔽的形式。通过增加针对特定UEFI / BIOS固件漏洞的受害设备的功能,TrickBot恶意软件能够以固件级别的持久性来针对特定的受害者,这种持久性可以在重装系统,甚至设备绑定功能中幸存。” UEFI是固件接口,是BIOS的替代品,可提高安全性,确保没有恶意软件破坏启动过程。因为UEFI有助于加载操作系统本身,所以这种感染可以抵抗OS重新安装或更换硬盘驱动器。 TrickBot于2016年以银行木马的身份出现,但后来演变为一种多功能的恶意软件即服务(MaaS),该恶意软件利用其他旨在窃取凭据,电子邮件,财务数据和传播文件加密勒索软件的恶意负载感染系统例如Conti和Ryuk。 郭盛华透露:“他们最常见的攻击链主要是从垃圾邮件活动开始的,然后再加载TrickBot和/或其他加载程序,然后转移到诸如PowerShell

VS Code Open new terminal from powershell

て烟熏妆下的殇ゞ 提交于 2020-12-05 10:02:00
问题 VS Code (Windows 10) What I want to achieve from ps1 script : open 4 terminal tabs first one run python venv and then run django server second one run python venv and then run django shell third one run react (yarn start) fourth normal powershell for git and other I created a powershell script that I run from default opened terminal. Now I'd like to open a new terminal tab from first one. Can I fire a vs code command shortcut (Ctrl+`) or a vs code command palette (Ctrl+Shift+P) from terminal

VS Code Open new terminal from powershell

∥☆過路亽.° 提交于 2020-12-05 09:58:17
问题 VS Code (Windows 10) What I want to achieve from ps1 script : open 4 terminal tabs first one run python venv and then run django server second one run python venv and then run django shell third one run react (yarn start) fourth normal powershell for git and other I created a powershell script that I run from default opened terminal. Now I'd like to open a new terminal tab from first one. Can I fire a vs code command shortcut (Ctrl+`) or a vs code command palette (Ctrl+Shift+P) from terminal

creating PowerShell custom objects

梦想的初衷 提交于 2020-12-05 05:26:29
问题 I created a custom object in PowerShell. I was able to solve the problem I wanted to solve. I wanted to have an object with two columns, one for the site collection, one for the email. However, I am wondering if there is an easier solution. Do you have any suggestions? Here is my code: $cred = Get-Credential Connect-PnPOnline "https://tenant.sharepoint.com" -Credentials $cred $SiteCollections = Get-PnPTenantSite $object = @() foreach ($SiteCollection in $SiteCollections) { Connect-PnPOnline

How to set Write permission on a folder for Everyone Using Powershell

空扰寡人 提交于 2020-12-05 05:09:40
问题 I am trying to share a folder with everyone and using the below command but it is not working. NET SHARE Movies=C:\foldername "/GRANT:Everyone,FULL" After runnign this command a message comes 'Movies Shared Successfully' but When i check folder permission it does not show the same. Can anyone tell me the correct command? 回答1: your net share works just fine. To set the folder permissions you need to set the ACL permissions: $sharepath = "C:\foldername" $Acl = Get-ACL $SharePath $AccessRule=

使用 FRP 反向代理实现 Windows 远程连接

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

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

廉价感情. 提交于 2020-12-04 19:52:59
问题 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