Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $list = Get-AdComputer -Filter *
- #Get-Content "path/to/list.txt"
- foreach($computer in $list.name)
- {
- Invoke-Command -ComputerName $computer -ScriptBlock {
- cmd /c 'DXDIAG /dontskip /X C:\temp\DeviceData.xml'
- }
- [xml] $xml = Get-Content -Path "\\$($computer)\c$\temp\DeviceData.xml"
- <#
- כאן אתה כבר בתוך הקובץ עצמו
- כלומר יש לך את כל המידע החומרתי של המחשב
- אם ה
- xml
- לא ברור
- אתה יכול לעשות לו formatter
- https://www.freeformatter.com/xml-formatter.html#ad-output
- הוא יראה יותר נחמד
- ואז אתה יכול לגשת לכל הפרמטרים דרך ה $xml
- דוגמה
- $xml.DxDiag.SystemInformation.BIOS
- #>
- $officeData=Invoke-Command -ComputerName $computer -ScriptBlock {
- $folder = Get-ChildItem 'C:\Program Files (x86)\Microsoft Office\Office*'
- cscript "$($folder.FullName)\ospp.vbs" /dstatus
- }
- $string=for($i=3;$i -lt $officeData.Count;$i++)
- {
- if($officeData[$i] -like "*:*")
- {
- $split = $officeData[$i].split(":")
- "`"$($split[0].Trim())`":`"$($split[1].Trim())`","
- }
- else
- {
- $officeData[$i]
- }
- }
- $string=$string | Out-String
- $string=$string.Replace("---Processing--------------------------
- ---------------------------------------","[{").Replace("---------------------------------------
- ---------------------------------------
- ---Exiting-----------------------------","}]")
- $string=$string.Replace("---------------------------------------","},{")
- $string=$string.Replace(",
- }","}")
- $json = $string | ConvertFrom-Json
- <#
- כאן יש לך את כל המוצרי office
- שיש לך על העמדה
- #>
- # product key
- $WindowsActivationKey=Invoke-Command -ComputerName $computer -ScriptBlock {
- powershell "(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey"
- }
- }
Add Comment
Please, Sign In to add comment