We will how to write a value in the registry of a remote PC enable remoting.
The Enable-PSRemoting cmdlet configures the computer to receive Windows PowerShell remote commands sent for differnet operations.
Example
$serv_machineName = "ServerName"
$remote=[microsoft.win32.registrykey]::openremotebasekey("LOCALMACHINE",$serv_machineName)
$val=$remote.opensubkey("SYSTEM\currentcontrolset\control\terminal server")
$val.setvalue("fDenyTSConnections", 0)