此命令使用Invoke-Commandcmdlet 在 Srv01 和 Srv02 计算机上运行Get-ChildItem命令。在 ExpiringInDays参数中) 值零0(获取已过期的 Srv01 和 Srv02 计算机上的证书。 PowerShell $invokeCommandSplat= @{ ComputerName ='Srv01','Srv02'ScriptBlock = {Get-
function Get-SystemInfo { param($ComputerName =$env:COMPUTERNAME) $header = 'Hostname','OSName','OSVersion','OSManufacturer','OSConfiguration','OS Build Type','RegisteredOwner','RegisteredOrganization','Product ID','Original Install Date','System Boot Time','System Manufacturer','System Model...
Get-CimInstance-ClassNameWin32_ComputerSystem |Select-Object-PropertySystemType SystemType --- X86-based PC 列出计算机制造商和型号 Win32_ComputerSystem中也提供了计算机型号信息。 标准显示输出不需要任何筛选便可提供 OEM 数据: PowerShell Get-CimInstance...
$events = Get-EventLog -LogName system | Where-Object { $_.eventID -eq $startUpID -OR $_.eventID -eq $shutDownID -and $_.TimeGenerated -ge $startingDate } 请记住,此命令只能本地运行。在 Windows PowerShell 2.0 中,您可以使用 –computerName 参数来远程运行此命令。下...
Get-PSSnapin Remove-PSSnapin Resume-Job Suspend-Job Microsoft.PowerShell.Diagnostics Export-Counter Import-Counter Microsoft.PowerShell.Management Add-Computer Checkpoint-Computer Clear-EventLog Complete-Transaction Disable-ComputerRestore Enable-ComputerRestore ...
Delete folder based on date of creation of folder Delete Folders base on the Creation Time Delete permissions on a folder. Delete printers on remote computer Delete registry key owned by TrustedInstaller Deleting a file Access to the path is denied deleting empty lines in an excel file Deleting...
First, import the list of computer names. In this example, assume that there is a list of names in a text file, but this could come from an AD query or another source. $remoteTargets = Get-Content .\names.txt Next, store the credentials in a variable. ...
Set-DateChanges the system time on the computer to a time that you specify. Set-ExecutionPolicyChanges the user preference for the Windows PowerShell execution policy. Set-ItemChanges the value of an item to the value specified in the command. ...
8. Get All Computers and IP Addresses Get-ADComputer -Filter * -properties * | select Name, Enabled,ipv4address This command gets all computers and displays the IP address of each computer. 9. Get All Computers lastlogondate Get-ADComputer -Filter * -properties * | select name,lastlogon...
When referring to theFunction:drive, type a colon afterFunction, just as you would do when referencing theCorDdrive of a computer. The following command displays all the functions in the current session of PowerShell: PowerShell Get-ChildItemFunction: ...