随笔分类 -  Powershell--Tips

摘要:实现类似Linux下的dd命令: 阅读全文
posted @ 2017-05-02 10:39 dongdonggeorge 阅读(508) 评论(0) 推荐(0) 编辑
摘要:Get-WmiObject win32_bios -ComputerName server1, server2 | Format-Table ` @{n='Hostname';e={$_.__server}}, @{n='SerialTag';e={$_.SerialNumber}}, @{n='OS';e={Get-WmiObject win32_operatingsystem... 阅读全文
posted @ 2015-05-11 09:34 dongdonggeorge 阅读(612) 评论(0) 推荐(0) 编辑
摘要:字符串分割: ‘abc 123 xyz ’.Split('',[System.StringSplitOptions]::RemoveEmptyEntries) #去除字符串间长度不一的”空隙“ ‘abc 123 xyz ’ -split "\s+|\t+" #去除字符串间长度不一的”空隙“ ‘abc 阅读全文
posted @ 2015-05-10 20:36 dongdonggeorge 阅读(207) 评论(0) 推荐(0) 编辑
摘要:如何将{}之间的内容逐个输出: Get-Service -Name winmgmt | Select DependentServices | foreach {$_.DependentServices} -OR- Get-Service -Name winmgmt | Select -ExpandP 阅读全文
posted @ 2015-05-08 18:20 dongdonggeorge 阅读(543) 评论(0) 推荐(0) 编辑
摘要:file.csv文件如下,然后对其中某些值进行变换操作,刚学Powershell的时候操作起来很麻烦,现在看来其实就是对于哈希表的操作。 col1,col2,col3,col4 text1,text2,text3,text4 text5,text6,text7,text8 text9,text10, 阅读全文
posted @ 2015-05-08 17:22 dongdonggeorge 阅读(637) 评论(0) 推荐(0) 编辑
摘要:Get-CimInstance -Classname Win32_NetworkAdapterConfiguration | Where {$_.IPAddress} | select -Property ipaddress-OR-Get-CimInstance -Classname Win32_N... 阅读全文
posted @ 2015-05-08 17:17 dongdonggeorge 阅读(196) 评论(0) 推荐(0) 编辑
摘要:在PowerShell中,可以通过Get-Content这个cmdlet来获取文本文件的内容。Get-Content将一个文本文件读取到一个数组中,每一个数组元素就是文件的一行内容。比如一个文本文件内容如下:111222333那么,使用Get-Content获取到一个数组,数组包括三个元素,值分别为... 阅读全文
posted @ 2015-05-08 17:07 dongdonggeorge 阅读(980) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示