uj könyvtär Scripts
This commit is contained in:
34
Scripts/powershell/WMI Config.ps1
Normal file
34
Scripts/powershell/WMI Config.ps1
Normal file
@@ -0,0 +1,34 @@
|
||||
# WMI Config
|
||||
|
||||
netsh firewall set service RemoteAdmin enable
|
||||
|
||||
netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes
|
||||
netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable=yes
|
||||
|
||||
# Connection Testen
|
||||
$strComputer = "Computer_B"
|
||||
$colSettings = Get-WmiObject Win32_OperatingSystem -ComputerName $strComputer
|
||||
|
||||
strComputer = "Computer_B"
|
||||
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||
Set colSettings = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
|
||||
|
||||
if ($colSettings) {
|
||||
Write-Host "WMI connection to $strComputer successful."
|
||||
} else {
|
||||
Write-Host "Failed to connect to WMI on $strComputer."
|
||||
}
|
||||
# WMI Test
|
||||
$wmiTest = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $strComputer
|
||||
if ($wmiTest) {
|
||||
Write-Host "WMI Test successful on $strComputer."
|
||||
} else {
|
||||
Write-Host "WMI Test failed on $strComputer."
|
||||
}
|
||||
# WMI Test with CIM
|
||||
$wmiTestCIM = Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $strComputer
|
||||
if ($wmiTestCIM) {
|
||||
Write-Host "CIM Test successful on $strComputer."
|
||||
} else {
|
||||
Write-Host "CIM Test failed on $strComputer."
|
||||
}
|
||||
Reference in New Issue
Block a user