跳到主要內容

Microsoft System Powershell

$compObject = get-wmiobject -query "select * from SMS_R_SYSTEM WHERE Name='[computername]'" -computername [sccm-server] -namespace "ROOT\SMS\site_[yoursite]"
$compObject.psbase.delete()


Remove-DisabledMonitoringObject
Remove-SCOMDisabledClassInstance

# To find out what options are available to your output of the list of objects in the group use Get-Member (GM) cmdlet
Get-SCOMGroup -DisplayName "UR Computer Group" | Get-SCOMClassInstance | GM

# after looking at the GM output we decide that DisplayName will work best
Get-SCOMGroup -DisplayName "UR Computer Group" | Get-SCOMClassInstance | sort DisplayName |FT DisplayName


For UIGeneratedMonitor:
Get-SCOMMonitor | where {$_.name -eq "UIGeneratedMonitorGUID#"} | select DisplayName

For UIGeneratedRule:
Get-SCOMRule | where {$_.name -eq "MomUIGeneratedRuleGUID#"} | select DisplayName

Create SCOM 2012 Subscribers using PowerShell
Add-SCOMNotificationSubscriber -Name ‘James Moss’ -DeviceList ‘james@contoso.com‘,’sms:4048675309′,’sip:JIMMYjames’

Deploying agents with Powershell
PS C:\> $PrimaryMgmtServer = Get-SCOMManagementServer -Name "omvnextqa03.qa.net"
PS C:\> Install-SCOMAgent -Name "Mdbqa01.qa.net" -PrimaryManagementServer $PrimaryMgmtServer

How To backup all SCOM MPs
Get-SCManagementPack | Export-SCManagementPack -path C:\MPDUMP

GET-SCOMAGENT
Disable-SCOMMonitor
Get-SCOMPendingManagement | where {$_.AgentPendingActionType -eq "ManualApproval"} | Approve-SCOMPendingManagement -WhatIf

###
[Reflection.Assembly]::Load(“Microsoft.EnterpriseManagement.Core, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″)
[Reflection.Assembly]::Load(“Microsoft.EnterpriseManagement.OperationsManager, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″)

    $mg = [Microsoft.EnterpriseManagement.ManagementGroup]::Connect(“localhost”)
    $mg.EntityObjects.DeleteDisabledObjects()

###

Deleting Agents



To determine what discoveries are still associated with a computer – helpful in finding old stale computer objects in the console that are no longer agent managed, or desired.
select BME.FullName, DS.DiscoveryRuleID, D.DiscoveryName from typedmanagedentity TME
Join BaseManagedEntity BME ON TME.BaseManagedEntityId = BME.BaseManagedEntityId
JOIN DiscoverySourceToTypedManagedEntity DSTME ON TME.TypedManagedEntityID = DSTME.TypedManagedEntityID
JOIN DiscoverySource DS ON DS.DiscoverySourceID = DSTME.DiscoverySourceID
JOIN Discovery D ON DS.DiscoveryRuleID=D.DiscoveryID
Where BME.Fullname like '%ComputerName%'


Disable-SCOMMonitor
Enable-SCOMMonitor

留言

這個網誌中的熱門文章

[經驗分享]開源IT資產管理系統 - Open-AudIT

企業營運必定與電腦系統脫離不了關係,每一部電腦散落在各部門、各辦公室,若是較具規模的公司,甚至會有跨好幾個地區的辦公室存在。 from Pocket http://ift.tt/2sI5nuB via IFTTT

RegistryChangesView 登錄檔比對工具,挖出某個設定修改了什麼..

在 Windows 電腦中,很多軟體在安裝/移除或執行時會在系統的「登錄檔」資料庫裡面加入、移除或修改許多項目,有些有修改是必須的,有些修改沒弄好的話可能會造成一些問題導致某些功能不正常或系統不穩定等等情況。 from Pocket http://ift.tt/2wiZCWi via IFTTT

Sonoff Zigbee 3.0 USB Dongle Plus燒錄ZigBee Router 模式

前言       Sonoff Zigbee 3.0 USB Dongle Plus燒錄為ZigBee Router 模式,可加以延伸ZigBee訊息(提供給ZHA 或Zigbee2MQTT) 1.下載韌體 https://github.com/Koenkk/Z-Stack-firmware/raw/master/router/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_router_20220125.zip 2.下載燒錄軟體(FLASH-PROGRAMMER-2 — SmartRF Flash Programmer v2) 要註冊才能下載 https://www.ti.com/tool/FLASH-PROGRAMMER 3.拆除Sonoff Zigbee 3.0 USB Dongle Plus外殼,按住靠近USB的按鈕不放,插入電腦USB後,等待10秒後,再放開 4.開啟燒錄軟體     點選COM Port(Unknow)- > CC2652P -> 勾選 Erase + Program -> Play(燒錄)     如果遇到失敗,大部份是步驟3沒做好,再重新拔插一下 5.如果看到成功,就大功告成了,開啟 ZHA 或Zigbee2MQTT配對模式後,就可以看到它了。 註:目前不知道如何重新配對,我都是執行重新燒錄動作 參考文章 https://forum.automata.id/t/topic/247 https://github.com/Koenkk/Z-Stack-firmware/raw/master/router/Z-Stack_3.x.0/