小编mar*_*001的帖子

Windows CMD中是否有与bash或tcsh中相同的源命令?

我知道在unix世界中,如果编辑.profile或.cshrc文件,可以使用source~/.profile或source~/.cshrc来获取当前会话的效果.如果我在Windows上更改了系统变量中的某些内容,如何在不退出命令提示符会话并打开另一个命令提示符会话的情况下使其影响当前的命令提示符会话?

unix windows bash cmd tcsh

29
推荐指数
4
解决办法
5万
查看次数

与对象的属性进行比较时,Get-ADUser -Filter 失败

我有一个与导入 csv 文件有关的 powershell 问题,然后通过 csv 文件进行 foreach。

我有如下内容:

$infile = "c:\temp\infile.csv"
$outfile = "c:\temp\outfile.csv"

$csv = Import-csv -path $infile
foreach ($line in $csv)
{
  $data = Get-ADUser -Filter {EmailAddress -eq $line.email} -Property Mail |     Select-Object -ExpandProperty SamAccountName
}
Run Code Online (Sandbox Code Playgroud)

当我做这样的事情时,我收到以下错误:

Get-ADUser : Property: 'email' not found in object of type: 'System.Management.Automation.PSCustomObject'.
At C:\Temp\program1.ps1:11 char:24
+         $ad_data = Get-ADUser <<<<  -Filter {EmailAddress -eq $line.email} -Property Mail | Select-Object -ExpandProperty SamAccountName
    + CategoryInfo          : InvalidArgument: (:) [Get-ADUser], ArgumentException
    + FullyQualifiedErrorId : Property: …
Run Code Online (Sandbox Code Playgroud)

powershell foreach

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

bash ×1

cmd ×1

foreach ×1

powershell ×1

tcsh ×1

unix ×1

windows ×1