Skip to content

Instantly share code, notes, and snippets.

@ab007shetty
Created June 30, 2021 15:06
Show Gist options
  • Save ab007shetty/e5ca8b344e9e971c9016bf44e7352b7f to your computer and use it in GitHub Desktop.
Save ab007shetty/e5ca8b344e9e971c9016bf44e7352b7f to your computer and use it in GitHub Desktop.
Important Powershell Commands Used in Google IT Support Specialization
Week 1:
(related to bash)
1. ls C:\ -list
2. get-help ls -full -full info about ls
3. ls C:\ -force -to show hidden items
4. pwd -print working directory
5. cd C:\Users\ABShetty -change directory
6. cd .. - moves one lvl up
7. cd ~ -( ~ tilde)path to home directory(user)
8. cd tab or start letter + tab -quick access to folders
9. mkdir folder_name - make folder(space not allowed)
10. mkdir 'folder name' or
mkdir my` folder` name -(back tick `)
11. history or ctrl+ r or arrow keys -recent commands list
12. cp filename path -copy
cp *.jpeg C:\Users\ABShetty -wildcard selection
cp 'folder-name' path -copies just folder not content
cp 'folder-name' path -recurse -verbse -with all contents and leaves msg.
13. mv file_name new_filename -rename
mv filename path -move( use wildcard)
14. rm path_with_filename -delete
rm path -force -to delte system files
rm folder_name -recurse -folder,else shell will ask with user
15. cat filename -opens entire file_name
cat filename -head 5 -shows 1st 5 lines
cat filename -tail 10 -last 10 lines
16. more filename -just 1 page,with more option below
enter key (advances 1 line)
space bar (advances by 1 page)
q key (quit)
17. start notepad++ filename -opens notepad
(any app u can launch with start )
-->Real powershell commands.
18. get-alias command_name -alias of that command.
19. select-string search_word filename -searches word in txt file
20.ls 'C:\Program Files\' -recurse -filter *.exe -searches with filter(* asterisk)
21. echo some_words > filename -creates file & writes
(echo boli > dog.txt)
(echo maga >> dog.txt) - (>> append) not overwrite,it updates
22. command | another_command -concatinates commands
23. rm secure_file 2> errors.txt -deletes file and moves to another file.
( 1: stdout and 2: stderr)
( $null a folder,never exixts)
(get-help about_redirection)
------------------------------------------------------------------------------
week -2:
1. Get-localuser -prints all users
( get-localgroup)
( get-localgroupmember group_name) -group member
2. net user -all users
3. net user user_name * -asterisk will prompt for pass change
4. net user user_name /logonpasswordchg:yes -forces user to change psswd on next login
5. net user user_name * /add -to add new user
6. net user user_name password /add /logonpasswordchg:yes -add user with pass change
7. net user user_name /del -to delete user
8. remove-localuser user_name -to remove localuser
9. icacls file_or_folder - shows file permissions
( icacls /? ) -help
10. icacls filename_with_path /grant 'Everyone:(OI)(CI)(R)' -Permission setting
( icacls 'c:\boli maga' /grant 'authenticate users:(OI)(CI)(R)' )
( icacls 'C:Vacation Pictres' /remove 'Everyone:(OI)(CI)(R)' ) -T0 remove permission
--------------------------------------------------------------------------------------------------------------
1. compress-archive -path file_path ~\Desktop\coolArchive.zip -compress file to coolArchive.zip
2. Register-PackageSource -Name chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2 -installs chocolatey
3. Get-PackageSource - Shows package managers
4. Find-Package sysinternals -IncludeDependencies -installs dependencies for chocolatey , it will extends capabilities.
5. install-package -name sysinternals - install-package
6. get-package -name sysinternals -shows info
7. uninstall-package -name sysinternals - deletes
8. Get-Process - lists all process with ID
9. Get-Process | sort CPU -descending | select -first 3 -property ID,ProcessName,CPU - custom list
10. putty.exe -ssh username@ip_address port_number -remote access through Plink
11. pscp.exe file_with_path username@ip_address - to share file remotely over scp using putty
12. net share shareMe=c:\users\cindy\desktop\shareme /grant:everyone,full -sharing folder to group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment