RSS

Category Archives: Cmdlets&Tools

repair file and folder permission is corrupt

today find my windows 10 10130 is fail to boot on due to the double boot windows 8.1 repair the windows 10 disk and repaired the disk which has no issue and in the end the whole windows 10 disk can not be accessed.

after try manually GUI fix the folder and file permissions it does not help too much (Take Ownership And Grant Permissions To Access Files & Folders).

While after some research, the cmdlet tools helps

takeown /f e:\* /R /A

icacls E:\* /grant administrators:(F) /inheritance:e /t

it is much faster than the gui operation.

Advertisements
 

check remote server administrator group members

this is a vbs.

Dim objGroup, strComputer
strComputer = "xy-PC"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Wscript.Echo "Members of local Administrators group on computer " & strComputer
Call EnumGroup(objGroup, "")

Sub EnumGroup(objGroup, strOffset)
Dim objMember
For Each objMember In objGroup.Members
Wscript.Echo strOffset & objMember.Name & " (" & objMember.Class & ")"
If (objMember.Class = "Group") Then
Call EnumGroup(objMember, strOffset & "–")
End If
Next
End Sub

 
Leave a comment

Posted by on October 25, 2010 in Cmdlets&Tools

 

query local administrators group member list

query local administrators group member list should be a very common task for daily administration. here is a method using WMIC remote Call due to it is shipped with Windows XP and Windows 2003.

code

wmic /node:”03r2″ /user:administrator /password:P@ssw0rd path win32_groupuser where (groupcomponent = ‘win32_group.name=”administrators”,domain=”03r2″‘)

wmic /node:”16.157.98.111″ /user:administrator /password:P@ssw0rd path win32_groupuser where (groupcomponent = ‘win32_group.name=”administrators”,domain=”03r2″‘)

change green string to the real pc’s netbios name or IP(recommend)

Screenshot

Tips:

wmic in Windows 5.x is a little different from Windows 6.x. you can try below code which is query local administrators group member ship. It  can success get result in Windows 7 but failed on windows XP or 2003.

wmic path win32_groupuser where (groupcomponent=”win32_group.name=”\administrators\”,domain=\”%computername%\””)

 
2 Comments

Posted by on October 9, 2010 in Cmdlets&Tools

 

Tags:

get user sid

1- powershell

gwmi win32_useraccount | ? {$_.name -eq “xy”}

PS C:\Users\xy> gwmi win32_useraccount | ? {$_.name -eq “xy”}

AccountType : 512
Caption     : xy-PC\xy
Domain      : xy-PC
SID         : S-1-5-21-1248425971-3961186720-2772201540-1000
FullName    :
Name        : xy

2-cmd

whoami /user /fo list

USER INFORMATION
—————-

User Name SID
========= ==============================================
xy-pc\xy  S-1-5-21-1248425971-3961186720-2772201540-1000

 
Leave a comment

Posted by on October 8, 2010 in Cmdlets&Tools

 

Tags: ,

subst

:\Windows\System32>subst /?
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to  a virtual drive.
  /D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

 
Leave a comment

Posted by on September 2, 2010 in Cmdlets&Tools

 

Tags:

Lockout fixer

AD Account lockout issue must be a common issue and most SA will feel boiling about it. here is an very useful tool for this.

download it from http://lockoutfixer.cz.cc

—-

hope helps.

 
 

Tags:

get installed patch list on the local computer

powershell:Get-WmiObject -Query ‘select * from Win32_QuickFixEngineering’ | ? {$_.installedon -like “*2010” } |sort installedon -descending | ft hotfixid,installedon

WMIC(shipped with windows by default)

wmic qfe get description,HotFixID,InstalledOn | findstr -i “2010”

 
Leave a comment

Posted by on June 12, 2010 in Cmdlets&Tools

 

Tags: ,

 
%d bloggers like this: