zoukankan      html  css  js  c++  java
  • Powershell(2)

    powershell(2)

    帮助系统(显示出来的参数语法要比Unix中help复杂)

    1. save-help -destinationpath c:help
    2. update-help -force -sourcepath c:help
    3. get-command -noun *log* -verb get -commandtype cmdlet|all|application
    4. [-arg] 为位置参数, 必须写在特定的位置
    5. [[-arg]] 可选又位置, 可以不写, 但是写了就要在特定的位置
    6. -arg 不是位置参数, 一定要写, 但是对位置没有要求
    7. (get-content C:demp.txt) ()中的优先级高, 强制限制性, 与Unix不同, Unix中是打开一个子shell执行
    8. 在每一个帮助信息中的参数都有[]选项, 可以通过get-help *common*, 结果返回一个about_commonparameter的帮助文档, 里面记录的那些是通用的选项
      • -verbose
      • -debug
      • -confirm
      • -whatif

    注意

    • 在windows中为了统一filesystem, wsman, registry等, 通过交item, 文件和文件夹叫item

    其他命令

    • out-file

      • -append
      • -width
      • -path
    • write-eventlog

    • write-output

    • convertTo-html

    • new-alias

      • export-alias
      • import-alias
    • show-command 图形显示, 并且可以执行命令

    • test-connection: ping

    • get-netfirewallrule

      • -direct inbound|outbound
    • get-psprovider|get-psdrive: 显示所有的提供程序, wsman, filesystem, register, alias, environment

    • get-childitem

      • new-item
      • remove-item
      • set-item
      • set-itemproperty: 设置属性, 一般配置get-itemproperty使用
      • get-item
        • -filter: 过滤掉指定的项
    • -literakpath: 不支持通配符

    • out-gridview: 将输入发送到图形界面上显示

    • export-cvs:

      • export-clixml
        • -delimiter
    • format-custom: 展开层级

    实验(1)

    • get-process | sort-object -property vm -decending | select-obejct -index 0,1,2,3,4 消耗内存前五名
    • get-services | select-object -property name, status | sort-object -property status -descending | export-csv services.csv
    • set-service -name bits -startiuptype manual
    • get-history -id 5 | invoke-history
    • new-eventlog -logname game -source cs 添加应用日志
  • 相关阅读:
    SQL Server ->> Database Snapshot(数据块快照)
    SQL Server ->> Sparse File(稀疏文件)
    Linux ->> Sudo命令
    Linux ->> mkdir命令
    Linux ->> VMWare Workstation虚拟机里的UBuntu系统安装VMWare-tools
    Microsoft Office ->> 完整卸载Office 2007
    SQL Server ->> XML方法
    SQL Server ->> 更改服务器时区对SQL Server Agent服务器的影响
    分析java内存情况
    oracle 10g 11g 12c区别
  • 原文地址:https://www.cnblogs.com/megachen/p/9504565.html
Copyright © 2011-2022 走看看