how to log off from samba server on windows 10 - windows

I have access to a Samba server using a username and password. To logging the server on windows 10, I put its IP address on the RUN and then input my username and password. Then I can access the data stored in the server normally. However, I don't know how to log off (or Sign out) from that server.
I followed this tutorial about how to access the server, but it does not mention the log off process. I need to log-off and log-in again with my username and password whenever I need to access the server.
Can anyone help?

"Try to restart your workstation".

TL;DR
Open CMD, type NET USE X: /DELETE or NET USE \\SERVER\SHARENAME /DELETE
where X: is your drive and \SERVER\SHARENAME your fully qualified share name.
Step by Step
View all network connections:
NET USE
Example Output:
Status Local Remote Network
--------------------------------------------------------------------------------
OK \\name\IPC$ Microsoft Windows Network
OK \\name2\folder Microsoft Windows Network
Using the Remote name, we can disconnect using on of the following statements, depending on which one we want to disconnect from:
net use \\name /delete
OR
net use \\name2\folder /delete
Example Output: (given the above \name\IPC being connected))
Net use \\name /delete
\\name was deleted successfully.
Another way, to disconnect from every share is to execute net use * /delete. This will disconnect every Network share you're currently connected to. This is still quicker than logging off and back on.
Bonus: make a script to do it
If you want to create an icon to automatically disconnect all network shares (using a GUI method), you can do the following:
Right-click on a blank area of the folder you want to add the shortcut to.
Point to New->Shortcut and click.
Type net use * /delete /y for the Command, then click Next.
Give it a name, and click Finish.
You can also specify a certain network share, if known in advance, and use that one instead. Using the /y automatically select the yes option in the command.
open notepad:
#echo off
::Disconnect user
net use * /delete /y
msg * /time:5 "You have been successfully Disconnected"
Copy paste save as a bat (file Extention " *.bat ", create a shortcut edit the shortcut to an icon of your choosing...
upon double click, the command will be run and a gui popup box will say the message and go away in 5 seconds or wait 5 seconds till appearing...
we use this quite a bit at work :)

Related

Script to Log into several user accounts

We manage several laptops that are used for emergency situations and thus are rarely used (knock on wood).
When we start up these laptops periodically to run windows updates, we also sign in with several user accounts for each laptop in order to keep the profile up to date.
Is there a way to automate the logging in of each account with a script?
For example, I could log in as administrator, run the script and the laptop would do the following:
Log out my administrator account,
sign in with useraccount 1, log out
sign in with useraccount 2, log out
sign in with useraccount 3, log out
I havent had much luck in googling this type of thing and was hoping someone here might have an idea.
I simply cant find a script that logs in with a user account.
The closest I can find is recommending auto signin but that only applies to one account and not what I need for this task.
Globally, you can't do that: it would break security if you were allowed to interact, programmatically, with the login screen.
IF it's possible, I would look to a way to do the login to remote machine through either Telnet (not recommended! but can be done with standard Windows tools) or SSH (will need a SSH server). If you can do the upgrade this way, then you're saved, in particular with SSH because you can avoid passwords' sharing through key exchange - probably won't work with domain accounts, however, but local accounts will be fine.
Otherwise, if you require to really open a Windows session, best you can do, IF your configuration allows it AND if it works (regarding the profile's update) is to connect through RDP (Remote Desktop) to each laptop, with each login.
You'll need to establish a RDP connection to each laptop from a "pilot" PC, save each connexion individually within a .rdp file, saving password inside the connection file.
Then, you can launch the connection with the command mstsc <machine+account>.rdp to establish a connection. A bit later, you can kill the connection (with either taskkill or through a pilot process / tool, I would use AutoIt for this preferably).
If password saving is an issue, then each employee should have its own set of RDP files. Through something like Autoit, in particular, you can input the password once, and fill automatically each password prompt.
The tricky part would be to know when it's time to close the remote desktop. I would try to automatically execute a command to distant computer that would reboot it once done, so your remote desktop would close automatically.
Anyway, it will be a real gas plant to implement all this in a smooth process...

Windows Server - Using default rdp license of 2 while having many RDP sessions disconnected makes the RD services busy

Hi
I want to test an application running in the background (of every logged in user) while users are logged in to the server using remote desktop but remote desktop session is disconnected.
My windows server 2016 is having the default 2 license for simultaneously connected users, which is all I need since I don't use more than 2 simultaneously connected users.
After ~15 login and disconnect, I start to experience a slowness while remote desktop of the next user.
Finally, it gets to a point where it takes very long time to connect and in some cases I get a message:
"The task you are trying to do can't be completed because remote desktop services is currently busy. please try again in a few minutes. Other users should still be able to log on."
Eventually, I manage to get my 150 users logged in to the server, but this behaviour is driving me crazy every time I need to test it again.
Is this behaviour something that Microsoft deliberately designed so I will have to use their license for multi users?
Again, I don't need simultaneously connected users...
Thanks,
Kobi
To solve above problem one can restart term service for btw machine remotely. Trigger below commands to do the same:
(1.) tasklist /s \\servername /svc /fi “imagename eq svchost.exe” (locate PID for TermService)
(2.) taskkill /s \\servername /pid xxxx (may need /f to force, UAC might give problems as well)
(3.) sc \\servername start TermService
You may try the following steps:
Login as Administrator
Open services.msc
Look for Remote Desktop Services
Right-click then click on Restart

raspberry pi 3 + windows 10 iot changing password makes device inacessible

I downloaded the raspi image from MS.
I have the issue where my computer thinks my admin is blocking the iot dashboard so I used the dism workaround to flash the sd card.
Device boots with defaults and I can log in via powershell as detailed in the MS docs. Administrator/p#ssw0rd
I change machine name using
set computername mycoolname
Then I create a new account for myself and add it to the local admin group.
Then I change the default admin password and reset.
When the raspi comes back up the hostname is still minwinpc and neither the built in admin account or the new one I created will work.
I tried the default password and the one I changed it to.
Anyone else have these issues? Ive tried waiting on the device to settle in, as others have reported that it can take time. Its not making a difference.
You may use the wrong command "set computername mycoolname". You need use "setcomputername mycoolname".
I do the following tests on the latest version 10.0.17763.1 and all work for me.
It will give the result of changing name like this:
Change password. No need reboot for password change.
For adding a user, for example:
net user rita windowsiot /add
net localgroup Administrators rita /add
Check the user added:
net localgroup administrators
Use the newly added user "rita" to login:

Execute RDP connection on multiple server

We have thousand of Windows server in our network. For some kind of work we need to log in on 100+ servers. We are doing it manually. Entering server name and giving credentials. Is it possible to create a batch file/script so, this work can be automated. Like we simply create a text file or csv and run the script. Script can open mstsc session and put credential in the mstsc. We can define username and password in the script.
Consider using remote desktop manager - remotedesktopmanager.com, it allows you to create several predefined remote desktopts, save different rdp settings for them, and switch between desktops in more convenient way.
Also when you connect via usual mstsc, you can save it as a separate rdp file and ask it to remember credentials when conecting first time, and just store separate rdp files that way.
This will launch Remote Desktop for all of the servers, but you still have to input credentials. There are ways you can implement Single Sign On but it only applies to Windows 2008 and 2008 R2. mstsc doesn't have any switches for username or password, so it can't be scripted. There isn't even a hack for it since you can't use sendkeys to a remote desktop window.
Create a file with server names one per line and put it in the same directory as the batch file.
Create the following batch file
#echo off
setlocal
cd /d %~dp0
set file=Servers.txt
for /f %%a in (%file%) do (
echo mstsc /v:%%a
)
Remove the echo to actually launch Remote Desktop. At least it takes 1 step out of the equation and you can always save your credentials so it doesn't prompt for them which is more secure than putting them in a file.

Determine Domain and username used to map a network drive

Using Windows 7 Enterprise with SP1, but I'm hoping to get a generic answer that would apply to Windows XP/2003/2008/Vista/7.
From a command prompt, I execute a net use command to map the Z: drive to a share on another computer, but I don't use my current credentials, I specify a different domain and user to map the drive.
net use z: \\rd-pc2037\C_DRIVE password /user:rd-pc2037\Administrator
The command completes successfully. Now that the drive is mapped, how can I find what Domain and Username I used to successfully map the drive? I can't seem to find what I want with the net use command.
C:\Users\rdomarat>net use
New connections will not be remembered.
Status Local Remote Network
----------------------------------------------------------------------------
OK Z: \\rd-pc2037\C_DRIVE Microsoft Windows Network
The command completed successfully.
C:\Users\rdomarat>net use Z:
Local name Z:
Remote name \\rd-pc2037\C_DRIVE
Resource type Disk
Status OK
# Opens 0
# Connections 1
The command completed successfully.
Checking the properties of the share in Windows Explorer and looking at the security tab showed me what permissions different people would have, but I didn't see how which DOMAIN\User I had used. I searched through the registry with limited success as well.
Any thought?
WMI is your friend:
> wmic netuse where LocalName="Z:" get UserName /value
UserName=rd-pc2037\Administrator
[anonymous suggestion 2022-08-07]:
Since Microsoft is gradually moving away from WMI,
Powershell/CIM is your future friend:
Get-CimInstance -classname Win32_NetworkConnection | select-object Remotename,Username
None of these answers help when using alternate credentials. They only show the current, local user. That doesn't help.
To view all stored credentials, use...
rundll32.exe keymgr.dll, KRShowKeyMgr
According to http://technet.microsoft.com/en-us/library/cc957215.aspx
the information you want is in the registry.
I have tried the wmic-command but it showed me the locally logged in user and not the "used DOMAIN\login"
The critical info from the link above:
Registry entry HKCU\Network\{Drive letter}\UserName is a REG_SZ that specifies the username (including domain name) whose credentials were used when the network drive was mapped.
Windows 11 -- some of this is useful, however Windows is still telling me that it has connected to a drive not listed in Windows Explorer, but which is not listed in computer, manage or net use or any of the options above. So Windows is storing connection information somewhere else.
There really should be a way to remove or replace persistent connections globally by username or servername.

Resources