Posts

Showing posts from June, 2015

PowerShell move files and change file name

Ports Replication Used by Active Directory

If replication is failing between servers in Active Directory, ports below should be checked whether they are open, block or other application is using them.

Port           135     RPC-based replication (Dynamic) TCP
LDAP       389     UDP / TCP
LDAP       636     TCP (SSL)
LDAP       3268   (Global Catalog)
Kerberos   88       UDP / TCP
DNS         53        UDP / TCP

From the list of ports the easiest one to troubleshoot is port 53, if replication is failing and at the same time users are complaining that they are not able to access websites using domain names such as facebook, twitter or youtube.

Then put DNS as top priority on troubleshooting procedures.

One good habit that Sys Ad should have is to take record every little change that has been made on the system.

Troubleshooting can be easier if there is a record for every change made.

Check out more details on this Technet links below:
https://technet.microsoft.com/en-us/library/cc772726(WS.10).aspx#w2k3tr_repup_how_huzs

https://…

PowerShell get folder security settings

How to check or get which accounts have the modify rights on a particular folder using PowerShell?

If the user account or security group account has modify rights, it means that account or group can delete the file or files on a folder.

To list the user accounts or security groups on a folder, a PowerShell scripts can come handy.

But of course it can be done via GUI, by right clicking on the folder and clicking on the security tab which will show the list of security accounts and its access settings.

The PowerShell code below will get the list of accounts which have modify rights on the folder specified on the script.

Here's the code:

$folder ="D:\myDFolder"
$acl = (Get-Acl $folder).Access   | where {$_.FileSystemRights -eq “Modify, Synchronize”} | select IdentityReference
Write-Output $acl

It's a three line code but does a very good job.

Sample output:
IdentityReference�������������������������������������������������������������������������������������������������������������…

Find XLSTART path using Excel VBA

Get or find default path for XLSTART.

Sub Find_XLSTART()

Dim Str_XLSTART As String

Str_XLSTART=  Application.StartupPath

Msgbox Str_XLSTART

End Sub

Message box will show the XLSTART path on the computer, copy and paste the path to windows explorer and press enter.


Check Default Printer using Excel VBA

A simple code snippet to check default or active printer using excel vba.

Sub GetPrinter()
Dim xprn As String

 xprn = Application.ActivePrinter

 MsgBox  xprn

End Sub

Mesagebox will display the default or active printer on the computer.

Excel VBA Read Formatted Cell value

Powershell get user info from name

Get user logon name (UPN), SID,OU membership from account name.

If you only have name as your info and you want to get other infos such as SID, UPN, OU membership and other details. A correct name should be good enough to get more details from PowerShell.

Code below will get this output:
- Get user SID
- Get user UPN or user logon name
- Get user Full Name
- Get user OU membership

=======================================

#set the user name to be queried
$user="Juan Karlos"

#code below will display the name and samaccountname
#$userinfo = Get-ADUser -Filter "Name -eq '$user'" | Select-Object name, samaccountname

#code below will display only the value or the samaccountname without the header
#-ExpandProperty will hide the header
$userinfo = Get-ADUser -Filter "Name -eq '$user'" | Select-Object  -ExpandProperty samaccountname

#Display more details about the user information
Get-aduser -Identity $userinfo

#Display the output on the console
write-host $userin…

Hyper-V VM does not respond to ping

Virtual Machine within the Hyper-V is not responding to ping, firewall could be blocking the response.

Open an elevated command prompt, type the command below:

   netsh firewall set icmpsetting 8

After typing this try to ping the IP Address of the VM it should respond to ping request.

If still doesn't work, make sure no other third party software installed on the VM that could be overriding the windows firewall.