Articles of PowerShell

Microsoft Exchange 2010:如何获得特定date的特定邮箱收到的电子邮件数量?

我正在使用Microsoft Exchange 2010。 如何获得特定date的特定邮箱收到的电子邮件数量? 例如,我想查看有多less电子邮件[email protected]在特定的date收到,并将其与另一个网站进行比较。

批量更新带有员工ID作为匹配键的AD属性

我有一个CSV文件,我需要批量更新AD。 该文件具有一个employeeID,它将与AD中的employeeID字段匹配。 到目前为止,如果只有一行信息,我就可以使用CSV文件成功更新用户。 我需要对脚本进行哪些更改才能更新许多用户/行? $Path = "C:\import\users-test.csv " $users = Get-Content –Path $Path | ConvertFrom-CSV $users | foreach { $_.psobject.properties | foreach { if ($_.value -eq "") { $_.value = $null }} $eid = $_.empID $user = Get-ADUser -Filter {employeeID -eq $eid} Set-ADUser $user.samaccountname -title $_.Title –department $_.department –description $_.Description –office $_.Office –streetAddress $_.Street –city […]

接受来自pipe道Powershell函数的值

我想创build一个脚本,告诉用户是否在多个远程机器上启用PSRemoting。 这是我到目前为止: function Test-PSRemoting { Param( [Parameter(Mandatory=$True, ValueFromPipeline=$True)] [string[]] $ComputerName, [string] $Credential) $file = Read-Host "Enter file location for all error details: " try { $result = Invoke-Command -ComputerName $ComputerName -Credential $Credential { 1 } -ErrorAction SilentlyContinue -ErrorVariable Problem If ($Problem){ $result = 0} } catch { $result = 0} If ($result -eq 1){ write-host […]

如何计算IP范围和子网?

我试图find下面的示例input的IP范围的确切公式 10.144.26.192/28 我在不同的门户获得不同的IP数量。 我使用了下面的在线IP范围计算器。 http://www.gregthatcher.com/Papers/IT/SubnetCalculator.aspx 子网掩码是:255.255.255.240 它显示结果为14 但在我的Azure门户地址数显示16 。 我创build了5个虚拟机和一个负载均衡器( 5 + 1 = 6 ),然后运行下面的powershell命令来查找空闲的IP地址。 (Test-AzureStaticVNetIP -VNetName “XYZS”-IPAddress 10.144.26.192).AvailableAddresses 它只显示5个可用的IP地址! 与Azure相比,这是正确的。 那么免费IP的其余部分在哪里呢? 或计算IP /子网范围的标准是什么? X的价值是什么应该得到3个子网,每个10 + IP 10.144.26.192/X

如何在远程计算机上查看Windows 10的版本?

从Windows Server 2012 R2,我想查看我的networking上的哪些工作站已经更新到Windows 10版本1511,1670等。 只是为了澄清,1511和1607是我正在寻找的数字。 我不想login到每个工作站(我可能有50或更多)。 我不太关心版本或内部版本号,除非这些版本可以以某种方式轻易地确定版本。

查找用户是否与使用PowerShell On-Premise的Office 365同步

是否有可能从本地AD查找用户是否与AzureAD(Office 365)同步? 以及该用户的同步是否发生? 我知道你可以看到在Office 365上,但我想尝试在内部find它。 Get-AdUser -Properties * -Filter *

Powershell脚本将运行,但屏幕捕获未完成,为什么?

我有一个PowerShell脚本来捕捉截图。 如果在PowerShell或ISE中运行它运行良好,采取屏幕捕获没有问题。 当我在Windows任务计划程序上安排任务时,它只保存一个空白图像而不是屏幕截图。 任何想法为什么? 脚本: $path = "\\somelocation\" $fileName = "Test" $date = Get-Date -Format yyyyMMdd-hhmm $file = $path + $filename + $date + ".bmp" Add-Type -AssemblyName System.Windows.Forms Add-type -AssemblyName System.Drawing # Gather Screen resolution information $Screen = [System.Windows.Forms.SystemInformation]::VirtualScreen $Width = $Screen.Width $Height = $Screen.Height $Left = $Screen.Left $Top = $Screen.Top # Create bitmap using […]

从CMD文件发送SecureString密码到Powershell

我有一个CMD文件,我必须运行Powershell脚本传递用户名和密码:例如:PowerShell文件“%1” – 计算机“%2” – 用户名“%3” – 密码“%4”。 无论如何发送一个SecureString密码从CMD到PowerShell脚本? 让我再补充一点,让我的困境更加清晰:所以无论何时执行包含上述Powershell命令的CMD文件,我都会在命令行中传递所有参数(%1%到%4%)的值。 现在,当我传递这些参数时,它们将以明文forms传入,并且所有事件都会被logging到事件监视器中,ID为4688且启用了“高级审计”function。 我想要的是在这种情况下不可见的密码。

单线程使用Powershell查找AD域中的所有邮件服务器

我想使用PowerShell来查找给定网段或域范围内的所有可用邮件服务器。 这是可能的,你怎么能这样做?

PowerShell – 在每个目录下键入no并打开notepad2

你知道PowerShell或cmd.exe中的notepad命令吗? 我想为NotePad2做同样的事情我想在PowerShell中input以下命令并打开me.txt文件; PS C:\Apps> no -me 我怎样才能configuration?