Search

My notebook

Category

Uncategorized

PowerShell – show subfolder size.

PowerShell show subfolder size.

gci -force 'D:\folder-name\'-ErrorAction SilentlyContinue | ? { $_ -is [io.directoryinfo] } | % {
$len = 0
gci -recurse -force $_.fullname -ErrorAction SilentlyContinue | % { $len += $_.length }
$_.fullname, '{0:N2} GB' -f ($len / 1Gb)
}

 

Advertisements

SQL SERVER – How to Change Server Name?

1. Show SQL-server name.

SELECT @@SERVERNAME

2. To drop the current server name:

EXEC sp_DROPSERVER 'oldservername'

3. To add a new server name. Make sure local is specified!

EXEC sp_ADDSERVER 'newservername', 'local'

4. Restart SQL Services.

PowerShell:
Stop-Service -Name MSSQLSERVER
Stop-Start -Name MSSQLSERVER
Get-Service -Name MSSQLSERVER

Show sql service name: (get-itemproperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server').InstalledInstances

5. Verify the new name using:

1. SELECT @@SERVERNAME
2. SELECT * FROM sys.servers WHERE server_id = 0

How to find files in Linux using ‘find’

find / -name file.name

Find highest CPU, Memory & MySQL Usage for cPanel accounts

OUT=$(/usr/local/cpanel/bin/dcpumonview | grep -v Top | sed -e ‘s#<[^>]*># #g’ | while read i ; do NF=`echo $i | awk {‘print NF’}` ; if [[ “$NF” == “5” ]] ; then USER=`echo $i | awk {‘print $1’}`; OWNER=`grep -e “^OWNER=” /var/cpanel/users/$USER | cut -d= -f2` ; echo “$OWNER $i”; fi ; done) ; (echo “USER CPU” ; echo “$OUT” | sort -nrk4 | awk ‘{printf “%s %s%\n”,$2,$4}’ | head -5) | column -t ;echo;(echo -e “USER MEMORY” ; echo “$OUT” | sort -nrk5 | awk ‘{printf “%s %s%\n”,$2,$5}’ | head -5) | column -t ;echo;(echo -e “USER MYSQL” ; echo “$OUT” | sort -nrk6 | awk ‘{printf “%s %s%\n”,$2,$6}’ | head -5) | column -t ;

 

USER CPU
user1 2.51%
user2 1.48%
user3 1.04%
user4 0.77%
user5 0.61%

USER MEMORY
user1 5.67%
user2 0.38%
user3 0.38%
user4 0.13%
user5 0.12%

USER MYSQL
user1 0.3%
user2 0.0%
user3 0.0%
user4 0.0%
user5 0.0%

Installing text mode setup tool

yum install setuptool system-config-securitylevel-tui authconfig system-config-network-tui ntsysv

 

setuptool : text setup tool console
system-config-securitylevel-tui : for configuring the firewall
authconfig : for configuring authentication
system-config-network-tui : for configuring the network
ntsysv : for configuring the system services

 

Backup And Restore Credentials In Windows 7,8 / 10

Part 1:- Creating Backup of Credentials:-

 

Step 1:- Press  + R and type
explorer shell:::{1206F5F1-0569-412C-8FEC-3204630DFB70} in the Run dialog box, hit Enter key to open Credential Manager snap-in.

1

Step 2 :- Now you can there two option available. One is Web Credentials and second is Windows Credentials. Select one which you want tack back up. For example, if you want tack back for Windows credentials then switched to Windows Credentials tab. Then click Back up Credentials link.
ced64-cradi6

Step 3:- Now the backup wizard has started and in the below shown window, click Browse button to choose a backup location.
28b77-cradi2

Step 4:- After Finish file saving process next, you’ll be asked to press CTRL+ALT+DELETE keys simultaneously to continue, hence do the needful.
9c42d-cradi3

Step 5:- When you click on Next button then next window asking you for password. Here i am suggest you password should be strong. Your all username and password are save in this file so be care for this file. Click Next…

aea3b-cradi4

Step 6:-Finally, you’ll get the backup was successful message and you’re done. Click Finish to close the wizard.

7e6a7-cradi5

In this way you can backup credentials. Now let’s see how to restore credentials from this same backup.
Part 2:- How to restore credentials from this same backup
Step 1:- Open Credential Manager and switch to Windows/Web Credentials tabs, depending upon for which side you want to restore credentials. Click Restore Credentials link there.

ced64-cradi6

Step 2:- Next, open the backup file in following window. The file must be having .crd extension

0e5bd-cradi7

Step 3:- Now you’ll be asked to press CTRL+ALT+DELETE keys to continue. Type in the password of this backup file. Click Next.

8f00b-cradi8

Step 4:- Once you clicked next in above shown window, your credentials are restored.  

Hope you find the guide useful!

 

 

How to Start, Stop, Restart VmTools

 

/etc/vmware-tools/services.sh status

/etc/vmware-tools/services.sh start

/etc/vmware-tools/services.sh stop

/etc/vmware-tools/services.sh restart

 

reconfig:

/usr/bin/vmware-config-tools.pl -d

 

W: Failed to fetch http://il.archive.ubuntu.com/ubuntu/dists/vivid-backports/restricted/i18n/Translation-en Bad header line

cd /var/lib/apt
sudo mv lists lists.old
sudo mkdir -p lists/partial
sudo apt-get update

Show public IP address.

wget http://ipinfo.io/ip -qO -

Create a free website or blog at WordPress.com.

Up ↑