Advertisement
Guest User

CustomService.format.ps1xml

a guest
Jul 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 4.06 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Configuration>
  3.  
  4.     <SelectionSets>
  5.         <SelectionSet>
  6.             <Name>ServiceControllerTypes</Name>
  7.             <Types>
  8.                 <TypeName>System.ServiceProcess.ServiceController</TypeName>
  9.             </Types>
  10.         </SelectionSet>
  11.     </SelectionSets>
  12.  
  13.     <ViewDefinitions>
  14.         <View>
  15.             <Name>services</Name>
  16.             <ViewSelectedBy>
  17.                 <SelectionSetName>ServiceControllerTypes</SelectionSetName>
  18.             </ViewSelectedBy>
  19.             <TableControl>
  20.                 <TableHeaders>
  21.                     <TableColumnHeader>
  22.                         <Label>Status</Label>
  23.                         <Alignment>right</Alignment>
  24.                     </TableColumnHeader>
  25.                     <TableColumnHeader>
  26.                         <Label>StartType</Label>
  27.                         <Alignment>right</Alignment>
  28.                     </TableColumnHeader>
  29.                     <TableColumnHeader>
  30.                         <Label>Name</Label>
  31.                         <Alignment>left</Alignment>
  32.                     </TableColumnHeader>
  33.                     <TableColumnHeader>
  34.                         <Label>DisplayName</Label>
  35.                         <Alignment>left</Alignment>
  36.                     </TableColumnHeader>
  37.                 </TableHeaders>
  38.                 <TableRowEntries>
  39.                     <TableRowEntry>
  40.                         <TableColumnItems>
  41.                             <TableColumnItem>
  42.                                 <ScriptBlock>
  43.                                     $status = $_.Status
  44.                                    
  45.                                     switch ($_.Status) {
  46.                                         'Running'{
  47.                                             "$([char](0x1B))[38;5;10m$status$([char](0x1B))[0m"
  48.                                         }
  49.                                         'Stopped'{
  50.                                             "$([char](0x1B))[38;5;9m$status$([char](0x1B))[0m"
  51.                                         }
  52.                                         default {
  53.                                             "$([char](0x1B))[38;5;13m$status$([char](0x1B))[0m"
  54.                                         }
  55.                                     }
  56.                                 </ScriptBlock>
  57.                             </TableColumnItem>
  58.                             <TableColumnItem>
  59.                                 <ScriptBlock>
  60.                                     $startType = $_.StartType
  61.                                    
  62.                                     switch ([string]$_.StartType) {
  63.                                         'Manual'{
  64.                                             "$([char](0x1B))[38;5;12m$startType$([char](0x1B))[0m"
  65.                                         }
  66.                                         'Automatic'{
  67.                                             "$([char](0x1B))[38;5;10m$startType$([char](0x1B))[0m"
  68.                                         }
  69.                                         'Disabled'{
  70.                                             "$([char](0x1B))[38;5;9m$startType$([char](0x1B))[0m"
  71.                                         }
  72.                                         default {
  73.                                             "$([char](0x1B))[38;5;13m$startType$([char](0x1B))[0m"
  74.                                         }
  75.                                     }
  76.                                 </ScriptBlock>
  77.                             </TableColumnItem>
  78.                             <TableColumnItem>
  79.                                 <PropertyName>Name</PropertyName>
  80.                             </TableColumnItem>
  81.                             <TableColumnItem>
  82.                                 <PropertyName>DisplayName</PropertyName>
  83.                             </TableColumnItem>
  84.                         </TableColumnItems>
  85.                     </TableRowEntry>
  86.                 </TableRowEntries>
  87.             </TableControl>
  88.         </View>
  89.     </ViewDefinitions>
  90.  
  91. </Configuration>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement