随笔分类 -  PowerShell

摘要:Environment 获取 OSversion:$OSVersion = [System.Environment]::OSVersion.VersionWMI获取Caption:$OSCaption = (Get-WmiObject -class Win32_OperatingSystem).Caption版本转换获取小版本号[Version]:$IsWindowsServer2012Env = ([version]$scriptargs.OSVersion).Major -eq 6 -and ([version]$scriptargs.OSVersion).Minor -eq 2 -and 阅读全文
posted @ 2013-11-21 17:36 Binyao 阅读(1284) 评论(0) 推荐(0)
摘要:用InstallState来判断function Check-DataDeduplication{Import-Module "ServerManager" -ErrorAction SilentlyContinueif((Get-Module "ServerManager") -and (Get-WindowsFeature -name FS-Data-Deduplication -ErrorAction SilentlyContinue)){$scriptenv.IsExistDataDeduplicationEnv = (Get-WindowsFe 阅读全文
posted @ 2013-11-21 17:32 Binyao 阅读(320) 评论(0) 推荐(0)
摘要:获取文件版本信息,通过FileVersionInfo::GetVersioninfo(file) 来获取信息function Check-DdpstoreFileVersion{$DdpstorePath = Join-Path $Env:windir "System32\Ddpstore.dll"if(Test-Path $DdpstorePath){$DdpStoreFileVersionObj = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($DdpstorePath)if($DdpStoreFileVer 阅读全文
posted @ 2013-11-21 17:31 Binyao 阅读(939) 评论(0) 推荐(0)
摘要:1.Arithmetic operators(算术运算符)算术运算符包括加、减、乘、除、取模此外,加法运算符 (+) 和乘法运算符 (*) 还可对字符串、数组和哈希表进行运算。加法运算符将输入连接起来。乘法运算符返回输入的多个副本。运算符说明 示例-------- ------------------- -------------------------+ 整数相加;连接字符串、数组和哈希表 6+2 "file" + "name"— 值减值 6-2 (get-date).date - 1— 对数字取负 —4 -6+2* 整数相乘;按指定次数复制字符串和数 阅读全文
posted @ 2013-11-12 15:30 Binyao 阅读(714) 评论(0) 推荐(0)