随笔分类 - powershell
摘要:CommandType Name Definition Alias % ForEach-Object Alias ? Where-Object Alias ac Add-Content Alias asnp Add-PSSnapIn Alias cat Get-Content Alias cd Se
阅读全文
posted @ 2017-06-10 15:15
山的那一边
摘要:开启远程操作权限 Get-ExecutionPolicy Set-ExecutionPolicy RemoteSigned Powershell开启远程功能: Enable-PSRemoting 测试是否开启: Enter-PSSession -ComputerName localhost
阅读全文
posted @ 2017-06-05 16:45
山的那一边
摘要:1 $name="." 2 $items = get-wmiObject -class win32_NetworkAdapterConfiguration -namespace "root\CIMV2" -ComputerName $name | where{$_.IPEnabled -eq “True”} 3 foreach($obj in $items) { 4 Write-Host "DH...
阅读全文
posted @ 2017-06-05 16:12
山的那一边
摘要:Set-VM -Name w-* -MemoryStartupBytes 1610612736 //(1.5G=1610612736) ●统计每台Hyper-V服务器上的运行的虚拟机(串行) 1 $HVServer=@('HV01','HV02') 2 foreach($hv in $HVServe
阅读全文
摘要:命令说明:Get-VM : to get the list of running VMs from the source Hyper-V hostOut-Grid : with the new -PassThru parameter – to display an interactive list
阅读全文
摘要:" " //双引号中将尝试替换匹配的变量值 ' ' //单引号中不进行变量值替换 @" "@ // "here string",其中可包含任意字符(含回车和引号),将尝试替换匹配的变量值 @' '@ // "here string",其中可包含任意字符(含回车和引号),不进行变量值替换 { } //
阅读全文
posted @ 2017-02-16 15:00
山的那一边
摘要:获取远程Hyper-V主机上运行中的VM 获取远程Hyper-V主机上运行中的VM(排序) 获取群集中的VM数: 指定群集
阅读全文
摘要:★匹配txt的标题,从中取出以w开头的12个字符Get-ChildItem -Include *.txt -recurse | foreach {$_.Name.SubString($_.Name.IndexOf("w"),12);} | Sort-Object★匹配txt文本中的内容2000Sel...
阅读全文
posted @ 2014-12-25 14:04
山的那一边
摘要:1 function CopyFiles() 2 { 3 param( 4 [string]$destPath, 5 [string]$sourPath 6 ) 7 8 Copy-Item -Path $sourPath -Destination $destPath -Recurse -Force
阅读全文
posted @ 2014-12-04 11:22
山的那一边

浙公网安备 33010602011771号