随笔 - 911  文章 - 5  评论 - 94  阅读 - 243万

Update-ServiceTemplate

1: Update a service by using conventional servicing.
PS C:\> $Service = Get-SCService -Name "Service01"
PS C:\> $SvcTemplate = Get-SCServiceTemplate -Name "ServiceTemplate01"
PS C:\> $PendingTemplate = New-SCServiceTemplate -ServiceTemplate $SvcTemplate -Name "ServiceTemplate01" -Release "RTM"
PS C:\> Set-SCService -Service $Service -PendingServiceTemplate $PendingTemplate
PS C:\> Update-SCService -Service $Service
The first command gets the service object named Service01, which is a deployed service, and stores the object in the $Service variable.

The second command gets the service template object named ServiceTemplate01 and stores the object in the $SvcTemplate variable.

The third command creates an RTM release of the service template stored in $SvcTemplate.

The fifth command sets the pending template on the service instance to the updated service template stored in $PendingTemplate.

The last command updates Service01.
2: Update a service by using image-based servicing.
PS C:\> $Service = Get-SCService -Name "Service02"
PS C:\> $SvcTemplate = Get-SCServiceTemplate -Name "ServiceTemplate02"
PS C:\> $PendingTemplate = New-SCServiceTemplate -ServiceTemplate $SvcTemplate -Name "ServiceTemplate02" -Release "RTM"
PS C:\> $WebTier = Get-SCComputerTierTemplate -ServiceTemplate $PendingTemplate -Name "Web Tier"
PS C:\> $WebTemplate = Get-SCVMTemplate -ComputerTierTemplate $WebTier | Set-SCVMTemplate -MemoryMB 2048
PS C:\> $BaseDisk2 = Get-SCVirtualHardDisk -Name "Win2k8R2BaseDisk_Patched.vhd"
PS C:\> $VHD = Get-SCVirtualDiskDrive -VMTemplate $WebTemplate 
PS C:\> Remove-SCVirtualDiskDrive -VirtualDiskDrive $VHD
PS C:\> New-SCVirtualDiskDrive -VirtualHardDisk $BaseDisk2 -VMTemplate $WebTemplate -BootVolume -SystemVolume -Bus 0 -LUN 0 -ide -VolumeType BootAndSystem
PS C:\> Set-SCService -Service $Service -PendingServiceTemplate $PendingTemplate 
PS C:\> Update-SCService -Service $Service
The first command gets the service object named Service02 and stores the object in the $Service variable.

The second command gets the service template object named ServiceTemplate02 and stores the object in the $SvcTemplate variable.

The third command creates a new release of the service template stored in $SvcTemplate, names it ServiceTemplate02, gives it a release of RTM and stores the template in $PendingTemplate.

The fourth command gets the computer tier object named Web Tier for the service template stored in $PendingTemplate and stores the object in the $WebTier variable.

The fifth command adds memory to the virtual machine template for the computer tier stored in $WebTier.

The sixth command gets the virtual hard disk object named Win2k8R2BaseDisk_Patched.vhd and stores the object in the $BaseDisk2 variable. This virtual hard disk contains an updated version of the operating system.

The seventh command gets the virtual disk drive object on the virtual machine template stored in $WebTemplate and stores the object in the $VHD variable.

The eighth command removes the virtual disk drive object stored in $VHD.

The ninth command adds the virtual hard disk object stored in $BaseDisk2 to the virtual machine template object stored in $WebTemplate.

The tenth command sets the pending template on the service instance to the updated service template stored in $PendingTemplate.

The last command updates Service02.


From:http://systemscenter.ru/vmm2012cmdlets.en/Update-SCService.html
posted on   momingliu11  阅读(515)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

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