我目前正在使用PowerShell中的比较对象函数来比较两个不同csv文件中的电子邮件地址。 这工作正常,以提供一个输出,告诉我,如果电子邮件地址是在一个或两个csv文件中find。 但是,有没有办法让我也从其他栏目中获取信息(即姓名,电话号码等)? 一个CSV文件只有电子邮件地址,另一个有几个不同的列。 我想要输出比较以及从另一个csv文件中select其他列信息,并将其输出到一个单一的csv中。 $file1 = import-csv -Path "c:\users\$env:USERNAME\Desktop\file1.csv" $file2 = import-csv -Path "c:\users\$env:USERNAME\Desktop\file2.users.csv" Compare-Object $file1 $file2 -property EmailAddress -IncludeEqual | Export-Csv c:\users\$env:USERNAME\Desktop\file3.csv 上面的代码是我到目前为止所做的工作。 它做我想要的一切,我只是不知道如何将其他列的输出包括到生成的CSV文件。 如果我必须采取全新的路线,我愿意提出build议。
问题:无法注册DSC窗口10(版本1709)客户端与拉服务器。 背景:下面是在将客户端更新到版本1709之前,为了注册Windows 10客户端节点(版本:1511)而正确实施和正常工作的环境/configuration的详细列表。使用以下方法重新创build了拉取服务器及其证书configuration保持configuration尽可能简单,以certificate问题。 拉服务器系统详情: 操作系统:Windows Server 2012 R2 WinVer:版本6.3(生成9600) PS版本:5.1.14409.1012 xPSDesiredStateConfiguration:7.0.0.0 拉服务器configuration: 拉服务器使用位于页面标题下的Microsoft示例脚本进行configuration:“设置Web拉服务器”(为了方便,在下面复制) configuration Sample_xDscPullServer { param ( [string[]]$NodeName = $Env:computername ) Import-DSCResource -ModuleName xPSDesiredStateConfiguration Import-DSCResource –ModuleName PSDesiredStateConfiguration Node $NodeName { WindowsFeature DSCServiceFeature { Ensure = 'Present' Name = 'DSC-Service' } xDscWebService PSDSCPullServer { Ensure = 'Present' EndpointName = 'PSDSCPullServer' Port = 8080 PhysicalPath = […]
我有一个成功的Windows版本的Cordova应用程序,可以通过运行Add-AppDevPackages PowerShell脚本部署到我的机器上。 我希望用户能够安装应用程序而不必运行脚本。 也就是说,他们可以下载应用程序,然后单击文件以安装在设备上,这就是我们提供iOS和Android版本的方式。 我的思考过程是1)我可以创build一个.msi文件设置向导,一旦打开文件就能运行PowerShell脚本? 要么 2)我需要一个类似于苹果证书的签名证书吗? 这是一个内部应用程序,所以没有必要去应用程序商店。
我正在关注这个链接,为Hyper-v虚拟机设置NAT,除了我使用GUI来创build虚拟交换机而不是使用PowerShell。 https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/setup-nat-network 当我试图在powershell中使用new-netnat创build一个NAT时,我得到了这个: Windows PowerShell Copyright (C) 2015 Microsoft Corporation. All rights reserved. PS C:\WINDOWS\system32> new-netnat -name NAT -InternalIPInterfaceAddressPrefix 192.168.1.0/24 new-netnat : A device attached to the system is not functioning. At line:1 char:1 + new-netnat -name NAT -InternalIPInterfaceAddressPrefix 192.168.1.0/24 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (MSFT_NetNat:root/StandardCimv2/MSFT_NetNat) [New-NetNat], CimException + FullyQualifiedErrorId : Windows System Error […]
我正在创build一个数组 $softwareguid = get-wmiobject -class Win32_Product | Where-Object -FilterScript {$_.Name -like "ESET*"}; 然后迭代执行msiexec silent remove,但无法构造variables来执行invoke-expression 。 码: foreach ($remove in $softwareguid){ $uninstallcmd = "Detected"$remove.Name"with GUID"$remove.IdentifyingNumber;} 导致以下错误:
我正在尝试通过Powershell命令在用户数据中引导EC2 Windows实例。 我试图通过用户数据执行的步骤是: 安装巧克力 使用巧克力来安装Python 使用巧克力来安装AWS CLI 使用AWS CLI从S3下载Powershell脚本 运行该Powershell脚本 用户数据非常简单: <powershell> Set-ExecutionPolicy Bypass -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); choco install python3 -y; choco install awscli -y refreshenv $BootstrapScript = (Join-Path $env:TEMP "NewBootstrap.ps1") & aws s3api get-object –bucket my-bucket-name –key bootstrap/WindowsBootstrap.ps1 "$BootstrapScript" iex "$BootstrapScript" </powershell> 引导脚本从不下载或执行。 如果我login到实例并查看日志,输出表明发生了一些奇怪的事情: 在日志的顶部有错误,抱怨'aws' is not recognized as the name of a […]
我在尝试着: 将服务器A的zip文件传输到服务器B。 服务器B将文件复制到不同的文件夹中。 服务器A通过SFTP传输: Import-Module C:\WindowsPowerShell\Modules\Posh-SSH Set-SFTPFile -SessionId $SFTPSession.SessionID -LocalFile $fileName -RemotePath $SftpTarget -Overwrite 服务器B注册一个事件来解压文件,当压缩文件被创build时: $onCreated = Register-ObjectEvent $filePath Created -SourceIdentifier ListenFileCreated -Action{ # Copy a zip file …. } 我的问题是,SFTP传输完成之前触发# Copy a zip file 。 所以当我试图解压文件时,我得到了“文件不完整”exception。 任何人都知道如何设置Register-ObjectEvent只在文件完成时触发,或者其他方式来检查文件是否正在使用?
我目前正在编写Powershell,现在我正在寻找一种方法来显示进度条,同时在系统中search文档。 我正在使用Get-ChildItem而不是循环,因为它比循环更快更有效。 我已经想出了如何使用Get-ChildItem cmdlet,但是我需要帮助弄清楚如何在其中实现进度条。 这里是我正在使用的代码的一个例子,所以它更容易理解: Set-Variable $Loading 0 Write-Progress -Activity "Collecting Files For Removal…" -CurrentOperation "Collecting User Files…" -PercentComplete $Loading Get-ChildItem C:\Users\firea\ -Filter *.D11 -ErrorAction SilentlyContinue -Force
我尝试在Windows10上使用Neo4J。 我已经下载了桌面应用程序(创build一个帐户后)。 如果我创build一个新的项目+数据库,出现错误: Database failed to start: DB closed with exit code 1. Check the logs 日志: AVERTISSEMENT: This command does not appear to be running with administrative rights. Some commands may fail eg Start/Stop 和 [2017-11-16 16:59:52:0877] [error] DB database-755f4ed3-c6be-4387-985b-191d743303ba closed with exit code 1 所以,我用pipe理员权限启动一个控制台(Cmd和PowerShell): C:\Users\ME\AppData\Roaming\Neo4j Desktop\Application\neo4jDatabases\database-755f4ed3-c6be-4387-985b-191d743303ba\current\bin>neo4j status The Neo4j Windows Service 'neo4j' […]
我是一个powershell noob,尽pipe我的谷歌search技巧,我一直无法找出如何find一个基于PowerShell中的模式的文件的目录,然后运行该文件。 这些是要求… 从特定的文件夹(C:\ TFS)开始 search名为“SpecFlow.bat”的特定batch file的文件夹并返回文件夹和文件path 从上一步返回的目录运行该文件 我有这样的事情,但我真的不知道我在做什么 Set-Location -Path C:\TFS $a = Get-ChildItem C:\TFS -Filter SpecFlow.bat -Recurse | % { $_.FullName } Start-Process $a 这似乎查找并运行该文件,但在“C:\ TFS”目录中。 因此,我在我的cmd窗口中得到以下错误… C:\TFS>SpecRun.exe run default.srprofile /basefolder:..\..\bin\release /outputfolder:output /report:MyReport.html 'SpecRun.exe' is not recognized as an internal or external command, operable program or batch file. 我哪里错了? 对于奖励积分,我可以将我的batch file转换为所有的PowerShell? batch file的内容是…. […]