I have PHP application to create user accounts in our Windows Active Directory. This application is running on Apache and Debian 11. I have LDAP only (because of some apps which are not supporting LDAPS), so I'm unable to set password directly from PHP. I'm trying to achieve this using powershell via ssh. I have installed latest versions 7.2 on both linux and domain controller. On DC I added OpenSSH server and turned firewall off. I've added the linux computer to trustedHosts on DC.
I'm able to connect to DC from remote computer via putty and it runs smoothly. When I use [email protected] from linux server, it runs well too, however when I run something like this from linux server
Invoke-Command -ComputerName 192.168.2.11 -Credential $creds -Authentication Negotiate -ScriptBlock {Get-Process}
where $creds contains something like domain\lastname.firstname (also tried [email protected]) and password, it takes from 2 to 5 minutes to execute this command. When I try Enter-PSSession and connect to DC, every single command take several minutes to execute, for example if I run Get-Date, it take another 2-5 minutes to execute. Even when I just hit enter without command, I can continue with the terminal again after 2-5 minutes.
I've tried it on Debian9,Debian11, Windows Server 2019 and 2022.