My Most Used CLI/Powershell Commands by Product
I use CLI for almost all of my management and problem solving. This ranges from Cisco, Aruba Networks, Microsoft and Apple products. Below is a comprehensive list of my most uses and favorite commands and what they are used for.
Command Line/PowerShell
Turn off UAC
C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t
REG_DWORD /d 0 /f
Enable File and Print
Sharing
set service type= fielandprint mode= enable
Remove Inheritance using iCacls
icacls \Users Group\user or users* /inheritance:r(OI)(CI)(NP)(IO)
f:\winpex86>
dism /mount-wim /wimfile:f:\winpex86\winpe.wim /index:1 /mountdir:f:\winpex86\mount
dism /image:f:\winpex86\mount /add-driver /driver:f:\drivers\desktop /recurse
dism /unmount-wim /mountdir:f:\winpex86\mount /commit
dism /mount-wim /wimfile:f:\winpex86\winpe.wim /index:1 /mountdir:f:\winpex86\mount
dism /image:f:\winpex86\mount /add-driver /driver:f:\drivers\desktop /recurse
dism /unmount-wim /mountdir:f:\winpex86\mount /commit
Extraction Command
f:\Drivers\Laptop>expand ThinkPad_T520_W7x86.cab -f:*f:\drivers\laptop
IMAGEX Commands
Imagex /capture d: d:\name.wim "name" /compress none
SYSPREP Commands
C:\Windows\system32\sysprep>
sysprep /generalize /oobe /shutdown /unattend:"unattended.xml"
This script will turn on remote registry
sc \\computername start remoteregistry
Task Scheduler Fix for Sophos Errors
net stop "task
scheduler"
net stop "Sophos Agent"
del
"%allusersprofile%\Application
Data\Microsoft\Crypto\rsa\S-1-5-18\*.*" /AS /Q
del "%allusersprofile%\Application
Data\sophos\remote management system\3\agent\adapterstorage\sav\*.*" /Q
schtasks /delete /tn "New
scheduled scan"
net start "task
scheduler"
net start "Sophos
Agent"
Aruba AP (Access Point) Commands
Clear out OS and Configuration
-printenv-purgeenv
-clear os
-save
Cisco Switch Commands
To find switch neighbors: show cdp neighborh
To show VLANs: show vlan brief
To show VTP status: show vtp status
Static Port Mode Configuration
Switch#config t
Switch(config)#interface fastEthernet0/15
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#end
Default Switch Port configuration: default interface GigabitEthernet 1/0/1
Show Mac Address port on table: sh mac add dy | i (last 4 of Mac)
Power controller reports power Imax error
on 3750 Switches.
Switch(config)# int x/y
Switch(config-if)# power
inline port 2x-mode
Switch(config-if)# shut
Switch(config-if)# no
shut
Exchange 2010 Commands
Export specific Mailbox from Exchange
New-MailboxExportRequest -Mailbox DiscoverySearchMailbox{D919BA05-46A6-415f-80AD-7E09334BB852} -FilePath "\\clsex01\PST\DiscoveryMailbox.pst"
New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "nameofuser"
Search all Mailboxes for specific email/messages
New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "nameofuser"
Search all Mailboxes for specific email/messages
Get-Mailbox | Search-Mailbox -SearchQuery 'user@gmail.com' -TargetMailbox "Discovery Search Mailbox" -TargetFolder "AllMailboxes-user" -LogLevel Full



No comments:
Post a Comment