当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] PowerShell 命令

作者:精品下载站 日期:2024-12-14 22:06:43 浏览:14 分类:玩电脑

PowerShell 命令


PowerShell 提供了广泛的命令来利用 PowerShell 执行各种任务。 PowerShell 脚本语言基于 .NET 框架构建,专为系统管理、自动化和管理任务而设计。

PowerShell 命令涵盖了广泛的功能,包括模块、自动化任务、管理会话配置、网络驱动器、活动目录等等……

在本文中,我们将探讨 Windows PowerShell 命令、cmdlet 名称、命令别名和说明的列表。

PowerShell 命令列表

Cmdlet NameCommand AliasCommand DescriptionGet-Helpman, helpRetrieves information about PowerShell commands.Show-CommandshcmGenerates PowerShell commands in a graphical command window.ForEach-Object%Executes an action on each object in a collection.Where-Object?Filters objects from a collection based on their property values.Add-ContentacAppends data to a file.Get-ContentcatRetrieves the content from a file.Clear-ContentclcRemoves the contents of an item without deleting the item itself.Set-Locationcd, chdirChanges the current working location.Get-LocationpwdRetrieves the current working location.Get-ChildItemdir, lsLists files and directories in a file system drive.New-ItemniGenerates a new item like a file or folder.Add-PSSnapInasnpIntegrates one or more PowerShell snap-ins into the current session.Get-AliasgalRetrieves the aliases for the current session.New-AliasnalDefines a new alias for a command in the current session.Compare-Objectcompare, diffCompares two sets of objects. One set is the reference, and the other is the difference.Group-ObjectgroupDisplays objects in groups based on the value of the specific property.Copy-Itemcopy, cp, cpiCopies the item to a different specified location.Move-Itemmi, move, mvMoves an item to another location.Invoke-CommandicmExecutes commands on local or remote computers.Invoke-ExpressioniexInvokes commands or expressions locally.Invoke-Historyihy, rExecutes commands from the session history.Import-CSVipcsvGenerates table-like custom objects from the items in the CSV file.Export-CSVepcsvConverts objects into comma-separated (CSV) strings and stores them in a CSV file.Get-VariablegvRetrieves variables in the current console.Set-VariablesetAssigns a new value to a variable or creates a variable if it doesn’t exist.Get-ItemgiGets the item at the specified locations.Get-ItemPropertygpGets the properties of the specified items.Get-ItemPropertyValuegpvGets the value of one or more properties of a specified item.Get-ServicegsvRetrieves the list of services on local or remote computers and displays it.Set-ServicessvModifies the properties of a service.Start-Service sasvStarts one or more stopped services.Stop-ServicespsvStops one or more running services.Restart-ServicersvStops and starts one or more services.Suspend-ServicesuspSuspends one or more running services.Invoke-FunctionifnInvokes a function that is defined in the current session or script.Get-AclgaclRetrieves the security descriptor for a resource, such as a file or a registry key.Set-AclsaclChanges the security descriptor for a specified resource, such as a file or registry key.Register-ScheduledJobrsjobRegisters a new scheduled job.Get-ScheduledJobgsjobGets scheduled jobs on the local computer.Set-ScheduledJobssjobModifies the properties of a scheduled job.UnRegister-ScheduledJobursjobDeletes a scheduled job.Start-ScheduledJobsasjobStarts a scheduled job immediately.Stop-ScheduledJobspsjobStops a running scheduled job.Enable-ScheduledJobeasjobEnables a scheduled job.Disable-ScheduledJobdisjobDisables a scheduled job.Get-ScheduledJobOptiongsjoptGets the options that control the running of a scheduled job.Set-ScheduledJobssjoptModifies the options that control the running of a scheduled job.Get-JobTrigger gjtrGets the triggers that are defined for a scheduled job.New-JobTriggernjtrCreates a new scheduled job trigger.Add-JobTriggerajtrAdds a new trigger to a scheduled job.Remove-JobTriggerrjtrRemoves a trigger from a scheduled job.Set-JobTriggersjtrModifies a scheduled job trigger.Get-JobgjbGets the background jobs that were started in the current session.Receive-JobrcjbGets the results of background jobs.Remove-JobrmjbDeletes a background job.Start-JobstjbStarts a background job.Stop-JobspjbStops a background job.Wait-JobwjbSuppresses the command prompt until one or all jobs are complete.

结论

希望以上关于PowerShell基本命令的文章对您有所帮助。 PowerShell 提供了广泛的命令来执行各种任务。

了解 PowerShell 命令的概念和基础知识有助于提高脚本效率和稳健性。

您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯