Add this as a custom query in AD to get a list of accounts that are presently locked out. (&(&(&(&(&(objectCategory=person)(objectClass=user)(lockoutTime:1.2.840.113556.1.4.804:=4294967295))))))
Copy of the macro I used in my autosort Spreadsheet Private Sub Worksheet_Change(ByVal Target As Range) If Not (Application.Intersect(Worksheets(1).Range(“A150:H180”), Target) Is Nothing) Then DoSort End If End Sub Private Sub DoSort() Sheet1.Range(“A150:H180”).Sort Key1:=Sheet1.Range(“A1”), Order1:=xlAscending, _ Key2:=Sheet1.Range(“D1”), Order2:=xlDescending End Sub
SituationNumerous roaming profiles without the administrator added for NTFS permissions. Access was denied for copying, moving etc. Native tools for taking ownership of multiple folders and files for end user profiles. Command Taking OwnershipTAKEOWN.exe /F <folderpath> /R /A /D Y /F = path/R=recurvise/A=owner to administrators rather than logged on user/D = default answer to setting list […]
Problem After extracting a number of files from a ZIP file windows kept track of these files as dangerous by means of the files ‘stream’ (ie tracking where the file originated from) Typically to allow these files to execute you need to Right click the file > properties > UNBLOCK “This file came from another computer […]
‘VBSCRIPT Set wshShell = Wscript.CreateObject (“WScript.shell”) strUSER = inputbox(“Enter User Name”,”Enter User Name”) wshShell.run “cmd.exe /c dsquery user -name ” & Chr(34) & strUSER & Chr(34) & ” | dsmod user -disabled no & pause” set wshshell = nothing
‘vbscriptOption ExplicitDim objCommand, objConnection, strBase, strFilter, strAttributes, objUserDim strQuery, objRecordset, strdistinguishedName, strTSPath, strCN, objFSO, Set objCommand = CreateObject(“ADODB.Command”)Set objConnection = CreateObject(“ADODB.Connection”)objConnection.Provider = “ADsDSOObject”objConnection.Open “Active Directory Provider”objCommand.ActiveConnection = objConnectionConst ForWriting = 2‘…set the base DNstrBase = “<ldap://DC=domain,DC=/local>”strFilter = “(&(objectCategory=person)(objectClass=user))”strAttributes = “sAMAccountName,cn,distinguishedName”strQuery = strBase & “;” & strFilter & “;” & strAttributes & “;subtree”objCommand.CommandText = strQueryobjCommand.Properties(“Page Size”) […]
‘vbscript ‘list computers to check in com,puters.txt in same directory script is run from ‘will write server uptime to uptime.txt in same directory rfile = “computers.txt” wfile = “Uptime.txt” on error resume next Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 Set objFSO = CreateObject(“Scripting.FileSystemObject”) Set r = objFSO.OpenTextFile(rfile, ForReading, True) […]
‘vbscriptOption ExplicitDim oFS : Set oFS = CreateObject(“Scripting.FileSystemObject”)Function FolderEmpty(strFolderPathName) Dim oFiles, oFile, oFolder, oSubFolders, oSubFolder Dim blnFileFound : blnFileFound = False Set oFolder = oFS.GetFolder(strFolderPathName) Set oFiles = oFolder.Files If oFiles.Count > 0 Then FolderEmpty = False Exit Function End If Set oSubFolders = oFolder.SubFolders For Each oSubFolder In oSubFolders If Not FolderEmpty(oSubFolder.Path) Then FolderEmpty = False Exit Function End If Next FolderEmpty = TrueEnd FunctionDim strFolderPathName1 : strFolderPathName1 = “file://server/c$/folder“If […]
‘vbscriptconst HKEY_LOCAL_MACHINE = &H80000002 Dim oReg, strKeyPath, strValueName, strDisabled, objArgs, strComputer, arrComputersSet objArgs = WScript.Arguments arrComputers = Array(“server1″,”server2”) sOutput = “Logons Enabled(0) or Disabled(1)” & VBCRLF & VBCRLFFor EACH strComputer in arrComputers Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & strComputer & “rootdefault:StdRegProv”) strKeyPath = “SoftwareMicrosoftWindows NTCurrentVersionWinlogon” strValueName = “WinStationsDisabled” oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strDisabled sOutput = sOutput & strcomputer & ” ” & […]
‘vbscript – operates like a multimedia keyboards mute keySet WshShell = CreateObject(“WScript.Shell”)WshShell.SendKeys(chr(&hAD))