Quantcast
Channel: Remote Desktop Services (Terminal Services) forum
Viewing all articles
Browse latest Browse all 27765

WMI repository not updated with new configuration unless rebooted

$
0
0

Hi,

Running Windows 2012 Standard Edition, trying to steer the RDP-Tcp (protocol) to only listen to one specific adapter instead of the default "all network adapters" using a script. The problem is that I cannot get the code to become instantly updated, rather I need to reboot to make it work which is not my cup of tea. Once I reboot everything is working, but I dont wanna boot.... code example follows below; (written in PowerShell)

#Connect to the WMI TS repository:

$objWmiTerminalServices = (Get-WmiObject -Namespace "root\Cimv2\TerminalServices" -query "SELECT * FROM Win32_TSNetworkAdapterSetting"  | Where {$_.TerminalName -eq 'RDP-Tcp'})

$result = $objWmiTerminalServices.SelectNetworkAdapterIP("10.63.240.24") #<-- The IP / Adapter I want RDP to listen to....

$result.ReturnValue #<-- Returns 0, meaning IP was valid according to MSDN documentation....

#Reconnect to object to verify that config was accepted...

$objWmiTerminalServices = (Get-WmiObject -Namespace "root\Cimv2\TerminalServices" -query "SELECT * FROM Win32_TSNetworkAdapterSetting"  | Where {$_.TerminalName -eq 'RDP-Tcp'})

$objWmiTerminalServices.NetworkAdapterName #<-- First time, going from the default configuration of all network adapters, this works, but not back and forth...

#Lets revert back to all network adapters beeing bound to RDP

$objWmiTerminalServices.SelectAllNetworkAdapters()

As soon as I reboot, connect to the WMI TS repository again, the configuration has been updated. Tried only restarting the service but with no success... any clues? Also tried making the configuration stick using the following code once I have changed the RDP to be bound a specific adapter, see below;

$objWmiTerminalServices = (Get-WmiObject -Namespace "root\Cimv2\TerminalServices" -query "SELECT * FROM Win32_TSNetworkAdapterSetting"  | Where {$_.TerminalName -eq 'RDP-Tcp'})

$objWmiTerminalServices.SelectNetworkAdapterIP("10.63.240.24")

$objWmiTerminalServices.psbase.put()

Any clues on how to make the configuration sticky directly without reboot, and how to broadcast the change to all parts of the OS directly? Take care dudes...


br4tt3


Viewing all articles
Browse latest Browse all 27765

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>