Showing posts from February, 2016

PowerShell split and join string

How to split a string by space using PowerShell?
PowerShell provides an easy way to do it using "split" method in PowerShell.
The split method accepts any delimiter; it can be space, dash, comma or other characters as long as it has a pattern on the string.
The split method will literally split the string and the output is displayed on a separate line or separated via a line feed.
$string = "This is my test string"
$split_string_array = $string -split " "
Output will be: This
If there is a need to remove the spaces but combine the string in one line, PowerShell also provides the "join" method which basically combine or joins the string in one line.
Example: $string = "This is my test string"
$split_string_array = $string -split " "
$join_string_array = $split_string_array -Join ""
Write-Host $join_string_array
Output: Thisismyteststring
Using the join method, a string can be manipu…

Check User SID

To check the SID for a user whose profile is not currently login using WMIC, type: wmic useraccount where (name="user007") Replace "user007" with the correct username to get the user SID.
The SID will be displayed for that particular user being queried. This will be useful if the profile for that particular user cannot be loaded or corrupted and need to identify the SID for the corrupt user profile.
Editing the registry for corrupt user profiles must edit the correct SID or else multiple issues might occur to the system.

To check the SID of a currently login user; just open a command prompt and type:
whoami /user
The command above will display the username and SID of the currently login user.
To check for FQDN (Fully Qualified Domain Name):

   whoami /fqdn
The FQDN is useful for System Administrator to check which OU (organizational unit) the user belongs to.

To check the UPN (user principal name):

   whoami /upn

UPN output will be shown like an email address, the use…

Cannot FTP in Windows explorer

Change windows service startup type via command line

Linux Awk Simple Example