Thursday, January 7, 2010

Home /Check admin$ share using PoweShell /PowerShell / Check admin$ share using PowerShell

Check admin$ share using PowerShell

Here is a PowerShell script which you can use to test the admin$ share access.  This script is useful when you are performing computer migrations.  You can use a CSV file as an input file. 

image

This script generates 3 output files; Success_Computers.txtFailed_Computers.txt and UserNames.txt

Here is the Input.CSV file format:

image

Output:

image

Usage: Add all computer names to the Input.CSV file and run the PreMig.PS1 script.

Download: You can download the script from this location.

SS

Santhosh Sivarajan

Microsoft MVP · Identity & Cybersecurity Architect

Santhosh has 30+ years of hands-on enterprise experience in Identity and Access Management, Microsoft Entra ID, Active Directory, Microsoft 365 and Zero Trust architecture. He is the author of two books on Windows Server and security, and leads consulting, assessments and training at SAG Business Group.

16 comments:

How do I change the script to get to the computers at the old domain?

Also, not to be critical; your script is great - but you make a lot of assumptions by not explaining what changes need to be made to accommodate ones environment.

What do you mean by “old domain”? You can run this script from any domain.

Thanks for the feedback. However, you need to explain your requirements. Any scripts can be modified to accurate any environment.

You see you just answered my question. "What do you mean by “old domain”? You can run this script from any domain."

I wasn't sure if I needed to run this from the target domain, and make the necessary changes in the script. Now I know I can run it from the source domain. I know I should have figured this out, but it gets frustrating when technical professionals makes too many assumptions.
Again, I'm not trying to be critical.
Do you have VBS script or something that I can get the computers associated with the users?

Technical professionals have to make assumptions. Otherwise they won't be able to come up with a “generic” script like this :)

Regarding your “computers associated with the users” question, you can use different methods. Here is an example using profile LastAccessTime.

http://portal.sivarajan.com/2010/07/user-profile-and-os-info-powershell.html

Hi Santhosh,

Ping (part of PreMig1 Script)– Make sure you can ping the workstation from the migration?

Where is that command?

Ping is not included in this script. My assumption is that if you can access admin$ you should be able to access the computer without any issues.

Also, most of the customers are not allowing ICMP on their network these days.

I have another script on this site which includes Ping and admin$

Hi Santhosh,
I have few windows 2k3 and 2k8R2 servers and I have common Local admin account,I wanted to check in all server whether the Local admin account is able to log in or not ,how can I check this? The user name and passowrd is same for all the servers and I have created an excel sheet with Hostname~ IP~ user name~Password; I wanted to know whether it able to login to all the servers or not,if not able to login; an output file could be genreated by scipt and should proivde the server list which are denied the access,is it possible to have a script for this??
the way few people suggested me login to all servers and check ,but i dotn think it is going to be good choice as I have server in count of hundereds.

Please help with your suggestion

This comment has been removed by the author.

Mesmerized article written on this blog with other relevant information. It is straight to the point that how we can improve our skills as well as how we can be represented to a new stream of professionalism. Upgrade windows 10 home to pro key

I'm having issues with migrating Computers in Server 2012 R2 domain. I've found articles saying this could be due to DNS or not being able to have duplicate SPN's. Is there an easy workaround?

Post a Comment

Popular Posts
Workstation Trust Relationship Issue Issue: You receive the following error message, when you try to login to the domain.  The security database on the server does not have ... ADMT Service Account - Permission and Configuration The ADMT service account needs to have proper permission in source and target domains.  You don’t need to use 2 separate accounts.  You can ... My First Peek into Microsoft Exchange 2010 By Santhosh Sivarajan Before I really dive into Exchange 2010, I thought I would install and play with it first. I took some screen shots and notes during the ins... ObjectSID and Active Directory What is an objectSID in Active Directory? When a new object is created in Active Directory, Domain Controller assigns a unique value used ... AD Group Report - List Group Members in Active Directory–PowerShell Script Updated Script - http://portal.sivarajan.com/2011/10/search-ad-collect-local-admin-group.html Script #1 This script... Add Users to a Group–PowerShell Script Purpose – Add users to a group from an input file – PowerShell V2 Script.  Input file – Input file (Users.csv) contains samAccountName in... User Account Migration and Merging – Part I (ADMT) Part I - User Account Migration and Merging Using ADMT Part II - User Account Migration and Merging Using QMM pre-creating user account ... User Account Migration and Merging – Part II (Quest Migration Manager) Part I - User Account Migration and Merging Using ADMT Part II - User Account Migration and Merging Using QMM Pre-creating user account in... Delete Stale or Inactive Computer Accounts from Active Directory Here is an easy way to identify and delete inactive or stale computers in an Active Directory environment.  Using the dsquery command you c... Converting PowerShell (PS1) to EXE / Standalone Application As we know, there many applications available to convert a PowerShell file to a standalone executable file.  Based on my experience, PowerSh...