リモートデスクトップ接続を使用してサーバーにログインするアプリを作成していますが、VB.net経由でADユーザー名を取得して保存する必要があります。次のようなユーザー名を取得する方法をたくさん試しました。
Protected oNet = CreateObject("WScript.NetWork")
Protected user5 = oNet.UserName
Protected userName = oNet.ExpandEnvironmentStrings("%UserName%")
Protected userName1 = Environment.UserName
Protected objSysInfo = CreateObject("ADSystemInfo")
Protected objUser = GetObject("LDAP://" & objSysInfo.UserName)
Protected userName2 As String = objUser.CN
さらに、他のいくつかのメソッドがありますが、返されるのは「Server-Name $」だけです。IIS で何かが足りないのでしょうか、それともスティックの端が完全に間違っているのでしょうか?
どんな助けでも大歓迎です!