How to with Regular expressions

Hi, if you are using regular expressions, I recommend you the following tools and sites: Regex tools to learn, build, test regular expressions: https://regexper.com/ https://regex101.com/ https://regexr.com http://regex.lumadis.be/test_regex.php?lang=fr Tutorials about regexp: http://en.wikipedia.org/wiki/Regular_expression http://www.regular-expressions.info/quickstart.html http://www.expreg.com/   Examples: .at matches any three-character string ending with “at”, including “hat”, “cat”, and “bat”. [hc]at matches “hat” and “cat”. [^b]at matchesContinue reading “How to with Regular expressions”

Logon script does not run when using UNC path or DFS path!

Symptom: Logon Script from AD User Profile Tab Not Working: When specifying the logon script via the user account ensure you do not enter a full UNC path or DFS path. \\domain.local\scripts\logon.bat does not work. logon.bat does does work. The logon script field in the user account properties automatically points to the netlogon directory. Workaround:Continue reading “Logon script does not run when using UNC path or DFS path!”

Start programs elevated from a batch file

If you use batch files to automate tasks on a Vista/Windows 7/Windows 2008,2008r2 computer, you have probably encountered situations when you needed to start a program ELEVATED (as Administrator). For example, if you want to share a folder automatically from a batch file, you would use the “net share” command. However, unlike many other programsContinue reading “Start programs elevated from a batch file”

How to script DCOM permissions and WMI security for non-admins ?

The objective is to allow WMI queries on a computer for a non-admin user/group ? the group to allow is mydomain\wmiquery-users the scripts requires, dcomperm.exe and wmisecurity.exe Authorize WMI users and set Permissions on Win7, Win2008 R2:http://technet.microsoft.com/en-us/library/cc771551.aspx example of PS code:http://unlockpowershell.wordpress.com/2009/11/20/script-remote-dcom-wmi-access-for-a-domain-user/ Download the wmisecurity.exe from codeproject site:http://www.codeproject.com/KB/system/WmiSecurity.aspx Download the dcomperm.exe from: http://cid-62b84429c3a8a991.skydrive.live.com/self.aspx/SharePoint/DComPerm.zip  1st step: SetContinue reading “How to script DCOM permissions and WMI security for non-admins ?”

Scan IP range using Ping or IP scanner for poors!

Just open up a cmd.exe and change the ip range.. C:\>FOR /L %x in (1,1,255) do ping -n 1 192.168.2.%x | find /I “reply” >> c:\temp\result.txt The above command uses a FOR loop to ping each device and looks for “Reply” in the output. If there is a “Reply” then the host is up.. ResultsContinue reading “Scan IP range using Ping or IP scanner for poors!”

VBScript: How Can I Use Alternate Credentials When Searching Active Directory?

Here’s a script that uses alternate credentials in order to search Active Directory: Const ADS_SCOPE_SUBTREE = 2 Set objConnection = CreateObject(“ADODB.Connection”) Set objCommand =   CreateObject(“ADODB.Command”) objConnection.Provider = “ADsDSOObject” objConnection.Properties(“User ID”) = “fabrikam\kenmyer” objConnection.Properties(“Password”) = “A2sXrco1Fq1#om!” objConnection.Properties(“Encrypt Password”) = TRUE objConnection.Properties(“ADSI Flag”) = 3 objConnection.Open “Active Directory Provider” Set objCommand.ActiveConnection = objConnection objCommand.Properties(“Page Size”) = 1000Continue reading “VBScript: How Can I Use Alternate Credentials When Searching Active Directory?”