Skip to main content

Posts

Showing posts from 2015

Use xargs to copy files that have spaces in their filenames

Copy files with spaces on its filenames in Linux? Use xargs parameter to copy files that have spaces on its filenames. In Linux to copy a file which has a space on the filename must be enclosed in a parenthesis. But if copying multiple files with has a space on their filenames is another story. It is still an easy task to do with the use of xargs parameter. Below is an example on how to use xargs to copy files with spaces on their filenames. Command tested on a Red Hat Linux operating system and works okay. Here's the command: find . -iname "*.txt" -print0 | xargs -0 -I  {} cp {} /home/backup/txt_2015 Do not omit -0 and -I parameters or else system will have this error: Above command will search for files with ".txt" extension and copy to /home/backup/txt_2015 folder. Replace the cp with mv if need to move files instead of copying. xargs: Warning: a NUL character occurred in the input.  It cannot be passed through in the argument l

PowerShell get folder security settings

How to check folder security settings? How to check folder security permissions? A lot of ways to do it, one is to use the graphical interface right click on the folder, click on properties, click on the security tab and it will show user accounts that is able to access the folder. PowerShell scripting also provides a way to automate this process. To determine or check the folder security settings and list whose user accounts is able to access the folder. Using the graphical interface is quite easy to check the user account that has access or permissions to a folder. To provide documentation or listing then a screen shot of the window is needed. For PowerShell, the permission, the access rights can be exported to a text file, CSV file or other preferred format for documentation or record purposes. If need to check on a remote server or computer PowerShell will be able to run a query quite efficiently, as long as proper credentials is used to run the

Force replication of Sysvol contents

In Active Directory domain, in Windows world sysvol folder needs to be consistent all through the domain. If the sysvol is inconsistent a lot of problems will happen. So for a smooth domain operation with less grumpy users "sysvol" folder has to be the same in all DC's. To force sysvol replication via command line: DFSRDIAG SyncNow /Partner:other_dc_name /RGName:”Domain System Volume” /Time:5 Check out this link from MS for more info: https://support.microsoft.com/en-us/kb/2218556 Another method is to go to control panel, then click on "Services". Then find "DFS Replication" service and click on restart. I did use this method before when I updated some batch file scripts and the script just doesn't sync even though the script is about 2KB in size only. The moment I restart the "DFS Replication" service, then I was able to see the changes on the other DC. I never test this command below but I guess it

Get network interfaces description in Windows

Netsh is a command line tool that is very useful provided of course you know exactly on how to use it. Below is an example on how to display the GUID and the description of the network interface card.    netsh trace show interfaces Sample output: Ethernet adapter Ethernet:     Description:      Intel(R) I350 Gigabit Network Connection     Interface GUID:   {1C8DC74A-0BCD-48FF-F3B7-26B1FF4D5650}     Interface Index: 12     Interface Luid:   0x8000008000000 Tunnel adapter isatap.{BCF65C9D-CB58-49F7-8BA1-88DBF2A6FBCE}:     Description:      Microsoft ISATAP Adapter #3     Interface GUID:   {F8BB0A84-D5A4-CA93-BA100-27EF2898CC82}     Interface Index: 19     Interface Luid:   0x12000005000000 The GUID (globally unique identifier) is used to identify objects in Windows registry.    The above command shows the description and the interface GUID, but the above command also can be used to sniff or capture traffic. netsh trace start capture=YES