SCCM Collection 集合获取计算机最后启动时间
获取计算机客户端最后一次启动时间,我们可以通过多种来源获取,如活动目录组 ,而不仅仅是SCCM 收集,希望对您有所帮助,下面分享PowerShell 脚本
# 1
$CollectionName = 'CollectionName'
$file = "Csv report file path"
$SiteServer = 'SCCMSERVER'
$SiteCode = 'YourSCCMSiteCode'
#Get the collection using WMI
$Collection = get-wmiobject -ComputerName $siteServer -NameSpace "ROOT\SMS\site_$SiteCode" -Class SMS_Collection | where {$_.Name -eq "$CollectionName"}
#Get the collection members
$CollectionMmebers = Get-WmiObject -ComputerName $SiteServer -Namespace "ROOT\SMS\site_$SiteCode" -Query "SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID='$($Collection.CollectionID)' order by name" | select Name
#The $CollectionMembers lastBoot
$data = @() ForEach($Computer in $CollectionMmebers) { try { $operatingSystem = Get-WmiObject Win32_OperatingSystem -ComputerName $($Computer.Name) $lastBoot = [Management.ManagementDateTimeConverter]::ToDateTime($operatingSystem.LastBootUpTime) } catch { $lastBoot = "ERROR Connecting" } $data += New-Object PSObject -Property @{ Name = $Computer.Name "Last Boot" = $lastBoot } } $data | Export-Csv $file
SCCM Collection 集合获取计算机最后启动时间的更多相关文章
- 浅谈Collection集合
俗话说:一个东西,一件事都离不开三句话:"是什么,为什么,怎么办" 集合是什么: 集合简单的说一个数组集合的高级体现,用来存储数据或对象的容器: 集合为什么存在: 集合只是体现了对 ...
- Collection集合的功能及总结
Collection集合是集合顶层接口,不能实例化 功能 1.添加功能 boolean add(Object obj):添加一个元素 boolean addAll(Collection c):添加一个 ...
- Collection集合List、Set
Collection集合,用来保存一组数据的数据结构. Collection是一个接口,定义了所有集合都应该包含的特征和行为 Collection派生出了两类集合 List和Set List接口:Li ...
- javad的Collection集合
集合框架:★★★★★,用于存储数据的容器. 特点: 1:对象封装数据,对象多了也需要存储.集合用于存储对象. 2:对象的个数确定可以使用数组,但是不确定怎么办?可以用集合.因为集合是可变长度的. 集合 ...
- Java基础知识强化之集合框架笔记12:Collection集合存储字符串并遍历
1. Collection集合存储字符串并遍历 分析: (1)创建集合对象 (2)创建字符串对象 (3)把字符串对象添加到集合中 (4)遍历集合 2. 代码示例: package cn.itcast ...
- Java基础知识强化之集合框架笔记05:Collection集合的遍历
1.Collection集合的遍历 Collection集合直接是不能遍历的,所以我们要间接方式才能遍历,我们知道数组Array方便实现变量,我们可以这样: 使用Object[] toArray() ...
- Java基础知识强化之集合框架笔记04:Collection集合的基本功能测试
1. Collection集合的基本功能测试: package cn.itcast_01; import java.util.ArrayList; import java.util.Collectio ...
- Collection集合。
Collection集合. java.util.Collection 接口. 没有索引 是所有单列集合的最顶层的接口,里面定义了所有单列集合共性的方法. 任意的单列集合都可以使用Collecion接口 ...
- Collection集合复习方法回顾
Collection集合方法: add() //添加元素 remove() //移除元素 size() //返回集合长度 ...
随机推荐
- win10 安装nodejs,报错there is a problem in the windows installer package
今天重装了win10系统,开始安装各种软件,装到node的时候我崩溃了,报错there is a problem in the windows installer package··· 度娘了各种安装 ...
- idea自动重置language level和java compiler解决办法:修改setting
maven工程: 错误: -source 1.6 中不支持 diamond 运算符. 尝试按网的的方式修改后,自动恢复,也在pom文件指定版本,依然不行. 后来发现:pom这样配置了: <plu ...
- App Distribution Guide--(三)---Configuring Your Xcode Project for Distribution
Configuring Your Xcode Project for Distribution You can edit your project settings anytime, but some ...
- CodeForces 489B BerSU Ball (水题 双指针)
B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Vector源码剖析
参考:http://blog.csdn.net/ns_code/article/details/35793865
- 2018上海大都会 J-Beautiful Numbers(数位dp-模未知)
J-Beautiful Numbers 链接:https://www.nowcoder.com/acm/contest/163/J 来源:牛客网 时间限制:C/C++ 8秒,其他语言16秒 空间限制: ...
- [开发技巧]·TensorFlow&Keras GPU使用技巧
[开发技巧]·TensorFlow&Keras GPU使用技巧 1.问题描述 在使用TensorFlow&Keras通过GPU进行加速训练时,有时在训练一个任务的时候需要去测试结果 ...
- 使用BCG创建Pie
1.新建一个BCG的对话框,添加一个文本框,并修改属性,添加成员变量,并设置Category为Control. 2.在class CCharPieDlg : public CBCGPDialog修改文 ...
- 【NOIP模拟赛】密码锁
题目描述 hzwer有一把密码锁,由N个开关组成.一开始的时候,所有开关都是关上的.当且仅当开关x1,x2,x3,…xk为开,其他开关为关时,密码锁才会打开. 他可以进行M种的操作,每种操作有一个si ...
- Mac 下nginx 环境的配置
这个是在度娘那里学来的. 因为是使用brew所以先安装: 安装命令如下:curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo ...