IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

How to Remove Cached Credentials without Rebooting Windows

The typical situation is you’ve connected to a network share with a User ID and a password. Then for one reason or another, the password was changed.

As soon as you get asked to enter the User ID and password again, even after entering the latest password, you’re still getting an error message:

Open Folder

\\server_name\c$ is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

The issue is after the password was recycled, the old password is still cached in your system, so we need to clear out the cache first.

You can check on what’s in the cache by opening a PowerShell or Command Prompt and type in the following:

C:\>net use

And you should see something similar to this:

C:\>net use
New connections will be remembered.


Status  Local    Remote                    Network
----------------------------------------------------------------------
OK      G:       \\Server1\Apps            Microsoft Windows Network
OK      H:       \\Server2\Customers       Microsoft Windows Network

Disconnected     \\server_name\c$          Microsoft Windows Network
The command completed successfully.

The network drive you’re looking for is the one that is disconnected and we need to delete it.

We can do so by typing the following command:

net use \\server_name\c$ /delete

And you will get confirmation that it was deleted successfully.

C:\>net use \\server_name\c$ /delete
\\server_name\c$ was deleted successfully.

Once you see this, you can close the PowerShell or Command Prompt windows and try to reconnect to the network share drive again.

Further Reading

How do I remove login credentials for a network location in Win7?
How to delete cached temporarily credentials for a network share on a Windows machine without rebooting or logging off

July 27, 2023 Filed Under: How To Tagged With: PowerShell, Windows

How to Change the Time Stamp of a File Using PowerShell

From time to time, you may need to modify the time stamp of a file for archiving or any other reasons.

This PowerShell script comes in handy when you need to do it. This is for a one-off tweak of a file. If you’re doing this in bulk, it’s probably better to use Robocopy with a /copy:T option (see an example here) to copy all the attributes including the time stamp.

PowerShell script to change the timestamp for a file

(Get-Item "C:\Temp\ITNota.txt").LastWriteTime=("6/1/2022 15:00:00")

Or

(Get-Item "C:\Temp\ITNota.txt").LastWriteTime=("1 June 2022 15:00:00")

Two versions of the script were provided to eliminate ambiguity of the date system. You just need to use one of them.

If you use the US date format, the first one will work. Otherwise, it’s always safer to spell out the date and the month.

Further Reading

How to Change File Date or Timestamp in Windows

July 20, 2022 Filed Under: How To Tagged With: PowerShell, Windows, Windows Server

How to Check Installed .NET Framework Version

This is a quick way to check an installed version of .NET Framework (as opposed to .NET Core). This works for any .NET Framework 4.5 or later.

We’re doing this by using a PowerShell script to get the value from the registry and a Python script to quickly match the release number to the associated .NET Framework version. This has been used so many times to get the value quickly on production servers, but use it at your own risk.

Steps

  1. On the server where you want to check the .NET Framework version, open a PowerShell window and run the following script:

    (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release
    
  2. Once you see the value, you can check it using the following Python script to see what version of .NET Framework that number corresponds to.

    #! python3
    # Check .NET version based on the release number
    # Reference https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
    
    releaseVersion = input("\nEnter .NET release number: ")
    
    def checkVersion(release):
    
        relNo = int(release)
    
        if relNo >= 528040:
            print('.NET Framework 4.8')
        elif relNo >= 461808:
            print('.NET Framework 4.7.2')
        elif relNo >= 461308:
            print('.NET Framework 4.7.1')
        elif relNo >= 460798:
            print('.NET Framework 4.7')
        elif relNo >= 394802:
            print('.NET Framework 4.6.2')
        elif relNo >= 394254:
            print('.NET Framework 4.6.1')
        elif relNo >= 393295:
            print('.NET Framework 4.6')
        elif relNo >= 379893:
            print('.NET Framework 4.5.2')
        elif relNo >= 378675:
            print('.NET Framework 4.5.1')
        elif relNo >= 378389:
            print('.NET Framework 4.5')
        else:
            print('No match')
    
    checkVersion(releaseVersion)
    

I’m sure there’s a more elegant way to do this by just running one script to do all these things but this is provided as it is.

Further Reading

How to Check Installed .NET Core Version
How to: Determine which .NET Framework versions are installed
How to Install Python on Windows Server

April 12, 2022 Filed Under: How To Tagged With: .NET, PowerShell, Python

How to Check Installed .NET Core Version

This is one way to determine what version of .NET Core is installed on your machine (or if it’s not installed):

  1. Launch Windows PowerShell.
  2. Runtime
    (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
    
  3. SDK
    (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
    

In the following example, you can see that .NET Core 2.1.2 Runtime is installed, but the SDK is not installed with the following error message:

dir : Cannot find path 'C:\Program Files\dotnet\sdk' because it does not exist.
At line:1 char:2
+ (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Program Files\dotnet\sdk:String) [Get-ChildItem], ItemNotFoundExcept
   ion
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
 
PS C:\Windows\system32>

PowerShell query for installed .NET Core version

Otherwise, it will look more like the next screenshot:

PowerShell query for installed .NET Core version for both Runtime and SDK

Another Way

There’s another way to accomplish the same thing with a much simpler command and this works on either Windows or macOS.

  1. Depending on your operating system, launch either Windows PowerShell or Terminal.
  2. Runtime
    dotnet --list-runtimes
    
  3. SDK
    dotnet --list-sdks
    
Installed .NET Core versions for both Runtime and SDK from PowerShell

Windows PowerShell

 

Installed .NET Core versions for both Runtime and SDK from macOS Terminal

macOS Terminal

 

When you see more than one entries, that means you have several versions installed and actually that’s the advantage of using .NET Core, you can have different versions installed side-by-side. The latest version is the last version number at the bottom of the result.

If you need a way to check the installed version of .NET Framework instead, check the link here.

Further Reading

How to Check Installed .NET Framework Version
How to determine if .NET Core is installed
How to: Determine which .NET Framework versions are installed
How to: Determine which .NET Framework security updates and hotfixes are installed
How to Remove .NET Runtime and SDK on Mac
How to Use System.Configuration.ConfigurationManager on .NET CORE

January 30, 2019 Filed Under: How To Tagged With: .NET, .NET Core, Microsoft, PowerShell, Windows

Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2025 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure