主要内容来自于

http://channel9.msdn.com/Events/TechEd/Australia/2014/DCI316

可以下载PPT以及视频,个人只是整理一下平时常用的

NetWork部分

PS C:\WINDOWS\system32> Get-NetIPConfiguration

InterfaceAlias       : vEthernet (LAN)
InterfaceIndex : 16
InterfaceDescription : Hyper-V Virtual Ethernet Adapter
NetProfile.Name : softland.com.cn
IPv4Address : 192.168.183.147
IPv6DefaultGateway :
IPv4DefaultGateway : 192.168.183.254
DNSServer : 192.168.181.51
192.168.181.52 InterfaceAlias : Bluetooth Network Connection
InterfaceIndex : 7
InterfaceDescription : Bluetooth 设备(个人区域网)
NetAdapter.Status : Disconnected InterfaceAlias : Wi-Fi
InterfaceIndex : 5
InterfaceDescription : Marvell AVASTAR 350N Wireless Network Controller
NetAdapter.Status : Disconnected

感觉ipconfig /all 差不多

PS C:\WINDOWS\system32> Get-NetAdapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
---- -------------------- ------- ------ ---------- ---------
vEthernet (LAN) Hyper-V Virtual Ethernet Adapter 16 Up 00-E0-4C-68-00-1C 100 Mbps
Wi-Fi Marvell AVASTAR 350N Wireless Networ... 5 Disconnected 28-18-78-CF-E4-D7 0 bps
Bluetooth Network Conn... Bluetooth 设备(个人区域网) 7 Disconnected 28-18-78-CF-E4-D8 3 Mbps
Ethernet 4 Realtek USB GBE Family Controller 15 Up 00-E0-4C-68-00-1C 100 Mbps PS C:\WINDOWS\system32> Get-NetAdapterStatistics Name ReceivedBytes ReceivedUnicastPackets SentBytes SentUnicastPackets
---- ------------- ---------------------- --------- ------------------
vEthernet (LAN) 2694328766 2430880 341456818 1424812
Wi-Fi 0 0 0 0
Bluetooth Network Connection 0 0 0 0
Ethernet 4 1224490613 47315 200354232 296054

显然配置IP等等信息以前都要爬到GUI里去处理,对于大量的需要远程的以及对面是小白用户对于管理员简直是灾难。显然可以使用以下的命令来直接设置(下面的是示例)

PS C:\WINDOWS\system32> Get-Help New-NetIPAddress -Examples

NAME
New-NetIPAddress SYNOPSIS
Creates and configures an IP address. Example 1: Add an IPv4 address PS C:\>New-NetIPAddress –InterfaceIndex 12 –IPAddress 192.168.0.1 -PrefixLength 24 -DefaultGateway 192.168.0.5 The second command removes the IPv4 address. To remove the IPv4 address, use the Remove-NetIPAddress cmdlet.
PS C:\>Remove-NetIPAddress –IPAddress 192.168.0.1 -DefaultGateway 192.168.0.5 The first command adds a new IPv4 address to the network interface at index 12. The PrefixLength parameter
specifies the subnet mask for the IP address. In this example, the PrefixLength of 24 equals a subnet mask of
255.255.255.0. When you add an IPv4 address, the address specified for the Default Gateway must be in the same
subnet as the IPv4 address that you add. PS C:\WINDOWS\system32>

DNS 设置方法

PS C:\WINDOWS\system32> get-help Set-DNSClientServerAddress -Examples

NAME
Set-DnsClientServerAddress SYNOPSIS
Sets DNS server addresses associated with the TCP/IP properties on an interface. EXAMPLE 1 PS C:\>Set-DnsClientServerAddress -InterfaceIndex 12 -ServerAddresses ("10.0.0.1","10.0.0.2") This example sets the DNS server addresses on a specified interface with the index value of 12.
EXAMPLE 2 PS C:\>Set-DnsClientServerAddress –InterfaceIndex 12 -ResetServerAddresses This example resets the DNS client to use the default DNS server addresses specified by DHCP on the interface with
an index value of 12. PS C:\WINDOWS\system32>

Ping 的一个替代

PS C:\WINDOWS\system32> Test-NetConnection

ComputerName           : internetbeacon.msedge.net
RemoteAddress : 204.79.197.200
InterfaceAlias : vEthernet (LAN)
SourceAddress : 192.168.183.147
PingSucceeded : True
PingReplyDetails (RTT) : 148 ms PS C:\WINDOWS\system32> Test-NetConnection 127.0.0.1 ComputerName : 127.0.0.1
RemoteAddress : 127.0.0.1
InterfaceAlias : Loopback Pseudo-Interface 1
SourceAddress : 127.0.0.1
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms PS C:\WINDOWS\system32> Test-NetConnection bing.com ComputerName : bing.com
RemoteAddress : 204.79.197.200
InterfaceAlias : vEthernet (LAN)
SourceAddress : 192.168.183.147
PingSucceeded : True
PingReplyDetails (RTT) : 148 ms

大家自己展开

加入Damain环境并重启

PS C:\>Add-Computer -DomainName Domain01 -Restart

Windows Service 管理

以前也是使用GUI界面来做,免不了要,可以使用到的Service命令

PS C:\WINDOWS\system32> Get-Command *-Service

CommandType     Name                                               ModuleName
----------- ---- ----------
Cmdlet Get-Service Microsoft.PowerShell.Management
Cmdlet New-Service Microsoft.PowerShell.Management
Cmdlet Restart-Service Microsoft.PowerShell.Management
Cmdlet Resume-Service Microsoft.PowerShell.Management
Cmdlet Set-Service Microsoft.PowerShell.Management
Cmdlet Start-Service Microsoft.PowerShell.Management
Cmdlet Stop-Service Microsoft.PowerShell.Management
Cmdlet Suspend-Service Microsoft.PowerShell.Management

使用离线的方式安装。光驱为D盘,显然要插入所安装的介质。这个问题还真是困扰Win8 WinServer2012的用户

Install-WindowsFeature Net-Framework-Core -source d:\sources\sxs

关于主机一些操作

PS C:\WINDOWS\system32> get-command *-computer

CommandType     Name                                               ModuleName
----------- ---- ----------
Cmdlet Add-Computer Microsoft.PowerShell.Management
Cmdlet Checkpoint-Computer Microsoft.PowerShell.Management
Cmdlet Remove-Computer Microsoft.PowerShell.Management
Cmdlet Rename-Computer Microsoft.PowerShell.Management
Cmdlet Restart-Computer Microsoft.PowerShell.Management
Cmdlet Restore-Computer Microsoft.PowerShell.Management
Cmdlet Stop-Computer Microsoft.PowerShell.Management

重命名主机名

PS C:\WINDOWS\system32> get-help Rename-Computer -Examples

NAME
Rename-Computer SYNOPSIS
Renames a computer. -------------------------- EXAMPLE 1 -------------------------- PS C:\>Rename-Computer -NewName Server044 -DomainCredential Domain01\Admin01 -Restart

防火墙相关配置命令

PS C:\WINDOWS\system32> get-help *-NetFirewallRule

Name                              Category  Module                    Synopsis
---- -------- ------ --------
Copy-NetFirewallRule Function NetSecurity Copies an entire firewall rule, and associated...
Disable-NetFirewallRule Function NetSecurity Disables a firewall rule.
Enable-NetFirewallRule Function NetSecurity Enables a previously disabled firewall rule.
Get-NetFirewallRule Function NetSecurity Retrieves firewall rules from the target compu...
New-NetFirewallRule Function NetSecurity Creates a new inbound or outbound firewall rul...
Remove-NetFirewallRule Function NetSecurity Deletes one or more firewall rules that match ...
Rename-NetFirewallRule Function NetSecurity Renames a single IPsec rule.
Set-NetFirewallRule Function NetSecurity Modifies existing firewall rules.
Show-NetFirewallRule Function NetSecurity Displays all of the existing IPsec rules and a...

Hyper-V 虚拟机相关命令,首先要安装Hyper-V组件

PS C:\WINDOWS\system32> get-command *-VM

CommandType     Name                                               ModuleName
----------- ---- ----------
Cmdlet Checkpoint-VM Hyper-V
Cmdlet Compare-VM Hyper-V
Cmdlet Debug-VM Hyper-V
Cmdlet Export-VM Hyper-V
Cmdlet Get-VM Hyper-V
Cmdlet Import-VM Hyper-V
Cmdlet Measure-VM Hyper-V
Cmdlet Move-VM Hyper-V
Cmdlet New-VM Hyper-V
Cmdlet Remove-VM Hyper-V
Cmdlet Rename-VM Hyper-V
Cmdlet Repair-VM Hyper-V
Cmdlet Restart-VM Hyper-V
Cmdlet Resume-VM Hyper-V
Cmdlet Save-VM Hyper-V
Cmdlet Set-VM Hyper-V
Cmdlet Start-VM Hyper-V
Cmdlet Stop-VM Hyper-V
Cmdlet Suspend-VM Hyper-V

虚拟机网络相关命令

PS C:\WINDOWS\system32> get-command *-VMNetworkAdapter

CommandType     Name                                               ModuleName
----------- ---- ----------
Cmdlet Add-VMNetworkAdapter Hyper-V
Cmdlet Connect-VMNetworkAdapter Hyper-V
Cmdlet Disconnect-VMNetworkAdapter Hyper-V
Cmdlet Get-VMNetworkAdapter Hyper-V
Cmdlet Remove-VMNetworkAdapter Hyper-V
Cmdlet Rename-VMNetworkAdapter Hyper-V
Cmdlet Set-VMNetworkAdapter Hyper-V
Cmdlet Test-VMNetworkAdapter Hyper-V

时间相关函数

PS C:\WINDOWS\system32> get-command *-date

CommandType     Name                                               ModuleName
----------- ---- ----------
Cmdlet Get-Date Microsoft.PowerShell.Utility
Cmdlet Set-Date Microsoft.PowerShell.Utility PS C:\WINDOWS\system32> get-date Tuesday, December 16, 2014 10:11:43 AM

获取本地补丁状况

PS C:\WINDOWS\system32> Get-HotFix

Source        Description      HotFixID      InstalledBy          InstalledOn
------ ----------- -------- ----------- -----------
MAGI Update KB2899189_... NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Update KB2843630 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Security Update KB2862152 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Security Update KB2868626 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Security Update KB2876331 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Update KB2883200 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Update KB2883295 9/19/2013 12:00:00 AM
MAGI Update KB2884846 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Update KB2887595 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
MAGI Security Update KB2892074 NT AUTHORITY\SYSTEM 11/10/2014 12:00:00 AM
。。。。

[整理归档]30 common tasks you perform using the GUI that you can do faster in Windows PowerShell的更多相关文章

  1. Common tasks that you can perform with the Groovy Script test step

    https://support.smartbear.com/readyapi/docs/soapui/steps/groovy.html Get test case object To obtain ...

  2. (排序算法整理)NEFU 30/32

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/caihongshijie6/article/details/26165093        事实上, ...

  3. Leetcode 题目整理-4 Longest Common Prefix & Remove Nth Node From End of List

    14. Longest Common Prefix Write a function to find the longest common prefix string amongst an array ...

  4. ESXI系列问题整理以及记录——使用Windows PowerShell中的SSH功能连接ESXI控制台

    首先进入ESXI管理页面,开启ESXI的SSH功能 接下来到位于同一局域网的Win主机上开启Powershell,如果ESXI主机的IP地址为192.168.1.77,则在Powershell中输入: ...

  5. 高效完成R代码

    为什么R有时候运行慢? 参考https://www.cnblogs.com/qiaoyihang/p/7779144.html 一.为什么R程序有时候会很慢? 1.计算性能的三个限制条件 cpu ra ...

  6. OnCommand® Unified Manager

    OnCommand Unified Manager Solution Components   The following components are downloaded and installe ...

  7. 常用js方法整理common.js

    项目中常用js方法整理成了common.js var h = {}; h.get = function (url, data, ok, error) { $.ajax({ url: url, data ...

  8. 项目中常用js方法整理common.js

    抽空把项目中常用js方法整理成了common.js,都是网上搜集而来的,大家一起分享吧. var h = {}; h.get = function (url, data, ok, error) { $ ...

  9. Redis 简单介绍(知识整理笔记)

    前言: Redis 介绍:轻量级.Key-Value.内存数据库.支持持久化 Redis 数据结构:string(字符串),hash(哈希),list(列表),set(集合)及 zset (sorte ...

随机推荐

  1. hough变换

    //c.h typedef unsigned char BYTE;typedef unsigned short WORD;typedef unsigned int DWORD;typedef long ...

  2. Ogre参考手册(五)3.2 合成器

    3.2 合成器Compositor 合成器框架是Ogre用于全屏后处理的API.你可以通过脚本而不是API定义合成器.你可以很容易为视口实例化合成器. 合成器基础 无论是要替换还是要与主渲染窗口混合, ...

  3. Orchard官方文档翻译(一) 总览

    原文地址:http://docs.orchardproject.net/ 最近想要学习了解orchard,但却没有找到相关的中文文档,只有英文文档.于是决定自行翻译,以便日后方便翻阅. 转载请注明原作 ...

  4. iScroll相关

    iScroll是一款用于移动设备web开发的一款插件.像缩放.下拉刷新.滑动切换等移动应用上常见的一些效果都可以轻松实现. iScroll的最新版本是2011.07.03发布的4.1.7版.最新版比以 ...

  5. Robotlegs2 学习笔记 -- SwiftSuspenders 2.x (2)

    Swiftsuspenders2简介 Swiftsuspenders2是一个基于元数据(metadata)的IOC(控制反转,inversion of control)的AS3的解决方案.(对于元数据 ...

  6. Flex应用一览表

    1.Flex控件之repeater和radioButton控件应用 2.Flex之DataGrid和Tree控件的数据源XML格式  3.Flex控件之combobox应用 4.转:Flex的Arra ...

  7. redis错误总结

    1.同步错误.不停重试一直不成功 Full resync from master: e51165e2868c541e28134a287f9bfe36372bae34:80575961684 MASTE ...

  8. 也谈LBP

    LBP(local banary patter)是一种非常经典的用来描述图像局部纹理特征的算子. 1,基本LBP LBP方法自1994年提出,此后就作为一个有效的纹理特征,不断的被人使用和改进.LBP ...

  9. 【EF 5】结合项目实战分析EF三大工作模式之—Database First

    导读:所谓的EF的Databasefirst工作模式,是目前我们(不涉及社会领域)用的最广的一种模式,也是本次ITOO开发所采用的工作模式.本篇博客,就分析在项目中通过Database First模式 ...

  10. CentOS 7服务

    重启防火墙service firewalld start/restart/stop 使用systemctl来启动/停止/重启服务要启动一个服务,你需要使用如下命令:# systemctl start ...