Disable-PSRemoting
PowerShell uç noktalarının uzak bağlantıları almasını engeller.
Syntax
Default (Varsayılan)
Disable-PSRemoting
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Disable-PSRemoting cmdlet'i yerel bilgisayardaki tüm Windows PowerShell oturum uç noktası yapılandırmalarına uzaktan erişimi engeller. Bu, PowerShell 6 veya üzeri tarafından oluşturulan tüm uç noktaları içerir.
Tüm oturum yapılandırmalarına uzaktan erişimi yeniden etkinleştirmek için Enable-PSRemoting cmdlet'ini kullanın. Bu, PowerShell 6 veya üzeri tarafından oluşturulan tüm uç noktaları içerir. Seçili oturum yapılandırmalarına uzaktan erişimi etkinleştirmek için cmdlet'in Set-PSSessionConfiguration parametresini kullanın.
Tüm kullanıcılar için oturum yapılandırmalarını etkinleştirmek ve devre dışı bırakmak için Enable-PSSessionConfiguration ve Disable-PSSessionConfiguration cmdlet'lerini de kullanabilirsiniz. Oturum yapılandırmaları hakkında daha fazla bilgi için bkz. about_Session_Configurations.
Uyarı
Disable-PSRemoting çalıştırdıktan sonra bile yerel makinede geri döngü bağlantıları yapabilirsiniz. Geri döngü bağlantısı, aynı yerel makineden kaynaklanan ve bu makineye bağlanan bir PowerShell uzak oturumudur. Dış kaynaklardan uzak oturumlar engellenmiş olarak kalır. Geri döngü bağlantıları için EnableNetworkAccess parametresi boyunca örtük kimlik bilgileri kullanmanız gerekir. Geri döngü bağlantıları hakkında daha fazla bilgi için bkz. new-PSSession .
Bu cmdlet'i çalıştırmak için Run yönetici seçeneğiyle PowerShell'i Windows başlatın.
Örnekler
Örnek 1: Tüm oturum yapılandırmalarına uzaktan erişimi engelleme
Bu örnek, bilgisayardaki tüm PowerShell oturum uç noktası yapılandırmalarına uzaktan erişimi engeller.
Disable-PSRemoting
WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these
steps:
1. Stop and disable the WinRM service.
2. Delete the listener that accepts requests on any IP address.
3. Disable the firewall exceptions for WS-Management communications.
4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
members of the Administrators group on the computer.
Örnek 2: Onay istemi olmadan tüm oturum yapılandırmalarına uzaktan erişimi engelleme
Bu örnek, istemeden bilgisayardaki tüm PowerShell oturum uç noktası yapılandırmalarına uzaktan erişimi engeller.
Disable-PSRemoting -Force
WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these
steps:
1. Stop and disable the WinRM service.
2. Delete the listener that accepts requests on any IP address.
3. Disable the firewall exceptions for WS-Management communications.
4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
members of the Administrators group on the computer.
Örnek 3: Bu cmdlet'i çalıştırmanın etkileri
Bu örnek, Disable-PSRemoting cmdlet'ini kullanmanın etkisini gösterir. Bu komut dizisini çalıştırmak için PowerShell'i yönetici olarak çalıştır seçeneğiyle başlatın.
Oturum yapılandırmaları devre dışı bırakıldıktan sonra, New-PSSession cmdlet'i yerel bilgisayarda bir uzak oturum oluşturmayı dener ("geri döngü" olarak da bilinir). Yerel makinede uzaktan erişim devre dışı bırakıldığından, komut başarısız olur.
Disable-PSRemoting -Force
New-PSSession -ComputerName localhost
WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
1. Stop and disable the WinRM service.
2. Delete the listener that accepts requests on any IP address.
3. Disable the firewall exceptions for WS-Management communications.
4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
members of the Administrators group on the computer.
New-PSSession : [localhost] Connecting to remote server localhost failed with the following error
message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ComputerName localhost -ConfigurationName PowerShell.6
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Management.A\u2026tion.RemoteRunspace:RemoteRunspace)
[New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Örnek 4: Bu cmdlet ve Enable-PSRemoting çalıştırmanın etkileri
Bu örnek, Disable-PSRemoting ve Enable-PSRemoting cmdlet'lerini kullanmanın oturum yapılandırmaları üzerindeki etkisini gösterir.
Disable-PSRemoting, tüm PowerShell oturum uç noktası yapılandırmalarına uzaktan erişimi devre dışı bırakmak için kullanılır.
Zorla parametresi tüm kullanıcı istemlerini gizler.
Get-PSSessionConfiguration ve Format-Table cmdlet'leri bilgisayardaki oturum yapılandırmalarını görüntüler.
Çıktı, ağ belirtecine sahip tüm uzak kullanıcıların uç nokta yapılandırmalarına erişiminin reddedildiğini gösterir. Yerel bilgisayardaki yöneticiler grubuna, yerel olarak bağlandıkları (geri döngü olarak da bilinir) ve örtük kimlik bilgilerini kullandıkları sürece uç nokta yapılandırmalarına erişim izni verilir.
Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize
Enable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell32 NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.ServerManager NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
WithProfile NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
Name Permission
---- ----------
microsoft.powershell BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow BUILTIN\Administrators AccessAllowed
microsoft.powershell32 BUILTIN\Administrators AccessAllowed
microsoft.ServerManager BUILTIN\Administrators AccessAllowed
WithProfile BUILTIN\Administrators AccessAllowed
Enable-PSRemoting cmdlet'i bilgisayardaki tüm PowerShell oturum uç noktası yapılandırmalarına uzaktan erişimi yeniden etkinleştirir.
Force parametresi tüm kullanıcı istemlerini gizler ve istemeden WinRM hizmetini yeniden başlatır. Yeni çıktı, AccessDenied güvenlik tanımlayıcılarının tüm oturum yapılandırmalarından kaldırıldığını gösterir.
Örnek 5: Devre dışı bırakılmış oturum uç noktası yapılandırmalarıyla geri döngü bağlantıları
Bu örnek, uç nokta yapılandırmalarının nasıl devre dışı bırakılıp devre dışı bırakılmış bir uç noktaya başarılı bir geri döngü bağlantısı yapılacağını gösterir.
Disable-PSRemoting tüm PowerShell oturum uç noktası yapılandırmalarını devre dışı bırakır.
Disable-PSRemoting -Force
New-PSSession -ComputerName localhost
WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
1. Stop and disable the WinRM service.
2. Delete the listener that accepts requests on any IP address.
3. Disable the firewall exceptions for WS-Management communications.
4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
members of the Administrators group on the computer.
New-PSSession : [localhost] Connecting to remote server localhost failed with the following error message : Access is
denied. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ComputerName localhost
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
gTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
New-PSSession -ComputerName localhost -EnableNetworkAccess
Id Name Transport ComputerName ComputerType State ConfigurationName Availability
-- ---- --------- ------------ ------------ ----- ----------------- ------------
1 Runspace1 WSMan localhost RemoteMachine Opened powershell.6 Available
New-PSSession ilk kullanımı yerel makinede uzak oturum oluşturmayı dener. Bu bağlantı türü ağ yığınından geçer ve bir geri döngü değildir. Sonuç olarak, devre dışı bırakılan uç noktaya bağlantı girişimi bir Erişimi reddedilir hatasıyla başarısız olur.
İkinci New-PSSession kullanımı da yerel makinede uzak oturum oluşturmayı dener.
Bu durumda, ağ yığınını atlayan bir geri döngü bağlantısı olduğundan başarılı olur.
Aşağıdaki koşullar karşılandığında bir geri döngü bağlantısı oluşturulur:
- Bağlanacak bilgisayar adı 'localhost' şeklindedir.
- Hiçbir kimlik bilgisi geçirilmemiş. Bağlantı için geçerli oturum açmış kullanıcı (örtük kimlik bilgileri) kullanılır.
-
EnableNetworkAccess
[switch]parametresi kullanılır.
Geri döngü bağlantıları hakkında daha fazla bilgi için bkz. New-PSSession belgesine.
Örnek 6: Özel güvenlik tanımlayıcılarına sahip oturum yapılandırmalarına uzaktan erişimi engelleme
Bu örnekte, Disable-PSRemoting cmdlet'inin özel güvenlik tanımlayıcılarına sahip oturum yapılandırmaları içeren tüm oturum yapılandırmalarına uzaktan erişimi devre dışı bırakması gösterilmektedir.
Register-PSSessionConfiguration
Test oturum yapılandırmasını oluşturur.
FilePath parametresi, oturumu özelleştiren bir oturum yapılandırma dosyası belirtir.
ShowSecurityDescriptorUI parametresi, oturum yapılandırması için izinleri ayarlayan bir iletişim kutusu görüntüler. İzinler iletişim kutusunda, belirtilen kullanıcı için özel tam erişim izinleri oluştururuz.
Get-PSSessionConfiguration ve Format-Table cmdlet'leri oturum yapılandırmalarını ve özelliklerini görüntüler. Çıktıda, Test oturum yapılandırmasının belirtilen kullanıcı için etkileşimli erişime ve özel izinlere izin verdiği gösterilir.
Disable-PSRemoting tüm oturum yapılandırmalarına uzaktan erişimi devre dışı bırakır.
Register-PSSessionConfiguration -Name Test -FilePath .\TestEndpoint.pssc -ShowSecurityDescriptorUI -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
New-PSSession -ComputerName localhost -ConfigurationName Test
Name Permission
---- ----------
microsoft.powershell BUILTIN\Administrators AccessAllowed
Test NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed,
DOMAIN01\User01 AccessAllowed
WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
1. Stop and disable the WinRM service.
2. Delete the listener that accepts requests on any IP address.
3. Disable the firewall exceptions for WS-Management communications.
4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
members of the Administrators group on the computer.
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
Test NT AUTHORITY\NETWORK AccessDenied, NTAUTHORITY\INTERACTIVE AccessAllowed,
BUILTIN\Administrators AccessAllowed, DOMAIN01\User01 AccessAllowed
[Server01] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Rem
ote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
Artık Get-PSSessionConfiguration ve Format-Table cmdlet'leri, tüm ağ kullanıcıları için AccessDenied güvenlik tanımlayıcısının Test oturum yapılandırması da dahil olmak üzere tüm oturum yapılandırmalarına eklendiğini gösterir. Diğer güvenlik tanımlayıcıları değiştirilmese de, "network_deny_all" güvenlik tanımlayıcısı önceliklidir. Bu, New-PSSession oturum yapılandırmasına bağlanmak için kullanma girişimiyle gösterilmiştir.
Örnek 7: Seçili oturum yapılandırmalarına uzaktan erişimi yeniden etkinleştirme
Bu örnekte yalnızca seçili oturum yapılandırmalarına uzaktan erişimin nasıl yeniden etkinleştirileceği gösterilmektedir. Tüm oturum yapılandırmalarını devre dışı bırakdıktan sonra belirli bir oturumu yeniden etkinleştiririz.
microsoft değiştirmek için Set-PSSessionConfiguration cmdlet'i kullanılır. ServerManager oturum yapılandırması.
AccessMode parametresi, Uzak değeriyle yapılandırmaya uzaktan erişimi yeniden etkinleştirir.
Disable-PSRemoting -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize
Set-PSSessionConfiguration -Name Microsoft.ServerManager -AccessMode Remote -Force
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -AutoSize
WARNING: Disabling the session configurations does not undo all the changes made by the Enable-PSRemoting
or Enable-PSSessionConfiguration cmdlet. You might have to manually undo the changes by following these steps:
1. Stop and disable the WinRM service.
2. Delete the listener that accepts requests on any IP address.
3. Disable the firewall exceptions for WS-Management communications.
4. Restore the value of the LocalAccountTokenFilterPolicy to 0, which restricts remote access to
members of the Administrators group on the computer.
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell32 NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.ServerManager NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
WithProfile NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
Name Permission
---- ----------
microsoft.powershell NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell.workflow NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.powershell32 NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
microsoft.ServerManager BUILTIN\Administrators AccessAllowed
WithProfile NT AUTHORITY\NETWORK AccessDenied, BUILTIN\Administrators AccessAllowed
Parametreler
-Confirm
Cmdlet'i çalıştırmadan önce sizden onay ister.
Parametre özellikleri
| Tür: | SwitchParameter |
| Default value: | False |
| Joker karakterleri destekler: | False |
| DontShow: | False |
| Diğer adlar: | Cf |
Parametre kümeleri
(All)
| Position: | Named |
| Zorunlu: | False |
| İşlem hattından gelen değer: | False |
| Özellik adına göre işlem hattından gelen değer: | False |
| Kalan bağımsız değişkenlerden elde edilen değer: | False |
-Force
Komutu, kullanıcı onayı istemeden çalışmaya zorlar.
Parametre özellikleri
| Tür: | SwitchParameter |
| Default value: | None |
| Joker karakterleri destekler: | False |
| DontShow: | False |
Parametre kümeleri
(All)
| Position: | Named |
| Zorunlu: | False |
| İşlem hattından gelen değer: | False |
| Özellik adına göre işlem hattından gelen değer: | False |
| Kalan bağımsız değişkenlerden elde edilen değer: | False |
-WhatIf
Cmdlet çalıştırılırsa ne olacağını gösterir. Cmdlet çalıştırılmaz.
Parametre özellikleri
| Tür: | SwitchParameter |
| Default value: | False |
| Joker karakterleri destekler: | False |
| DontShow: | False |
| Diğer adlar: | Wi |
Parametre kümeleri
(All)
| Position: | Named |
| Zorunlu: | False |
| İşlem hattından gelen değer: | False |
| Özellik adına göre işlem hattından gelen değer: | False |
| Kalan bağımsız değişkenlerden elde edilen değer: | False |
CommonParameters
Bu cmdlet yaygın parametreleri destekler: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction ve -WarningVariable. Daha fazla bilgi için bkz. about_CommonParameters.
Girişler
None
Nesneleri bu cmdlet'e yöneltemezsiniz.
Çıkışlar
None
Bu cmdlet çıkış döndürmez.
Notlar
Oturum yapılandırmalarının devre dışı bırakılması,
Enable-PSRemotingveyaEnable-PSSessionConfigurationcmdlet'leri tarafından yapılan tüm değişiklikleri geri almaz. Aşağıdaki değişiklikleri el ile geri almak zorunda olabilirsiniz.- WinRM hizmetini durdurun ve devre dışı bırakın.
- Herhangi bir IP adresinde istekleri kabul eden dinleyiciyi silin.
- WS-Management iletişimleri için güvenlik duvarı özel durumlarını devre dışı bırakın.
- LocalAccountTokenFilterPolicy değerini 0 olarak geri yükleyin. Bu değer, uzaktan erişimi bilgisayardaki Administrators grubunun üyeleriyle kısıtlar.
Oturum yapılandırması, oturumun ortamını tanımlayan bir ayar grubudur. Bilgisayara bağlanan her oturum, bilgisayarda kayıtlı olan oturum yapılandırmalarından birini kullanmalıdır. Tüm oturum yapılandırmalarına uzaktan erişimi reddederek, uzak kullanıcıların bilgisayara bağlanan oturumlar oluşturmasını etkili bir şekilde engellersiniz.
Windows PowerShell 2.0'da
Disable-PSRemoting, tüm oturum yapılandırmalarının güvenlik tanımlayıcılarına bir Deny_All girişi ekler. Bu ayar, tüm kullanıcıların yerel bilgisayarda kullanıcı tarafından yönetilen oturumlar oluşturmasını engeller. Windows PowerShell 3.0'daDisable-PSRemoting, tüm oturum yapılandırmalarının güvenlik tanımlayıcılarına bir Network_Deny_All girişi ekler. Bu ayar, diğer bilgisayarlardaki kullanıcıların yerel bilgisayarda kullanıcı tarafından yönetilen oturumlar oluşturmasını engeller, ancak yerel bilgisayar kullanıcılarının kullanıcı tarafından yönetilen geri döngü oturumları oluşturmasına izin verir.Windows PowerShell 2.0'da
Disable-PSRemoting,Disable-PSSessionConfiguration -Name *eşdeğerdir. Windows PowerShell 3.0 ve sonraki sürümlerdeDisable-PSRemoting,Set-PSSessionConfiguration -Name \<Configuration name\> -AccessMode Localeşdeğeridir
İlişkili Bağlantılar
- Disable-PSSessionConfiguration
- Enable-PSRemoting (PS Uzaktan Çalıştırmayı Etkinleştir)
- Get-PSSessionConfiguration komutunu çalıştır
- New-PSSession
- Register-PSSessionConfiguration (PSSession Yapılandırma Kaydı)
- Set-PSSessionConfiguration komutunu yapılandırın
- Unregister-PSSessionConfiguration (PSSession Yapılandırması Kaydını Kaldırma)
- WSMan Sağlayıcısı