thesuhu

Windows PowerShell

Feb 16th, 2020 (edited)
571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Mengetahui Berapa Banyak Core Prosesor (PowerShell)
  2. Get-WmiObject –class Win32_processor | ft NumberOfCores,NumberOfLogicalProcessors
  3.  
  4. # Mengetahui Berapa Banyak Core Prosesor (CMD)
  5. wmic cpu get NumberOfCores,NumberOfLogicalProcessors
  6.  
  7. # Mendapatkan informasi power
  8. Get-WinEvent -LogName System | Where-Object -FilterScript { $_.ProviderName -eq "Microsoft-Windows-Kernel-Power" } | Select -First 10
  9.  
  10. # Set windows variable, gunakan karakter = untuk baru/update, += untuk menambah
  11. $env:FTP_HOST=10.10.10.147
  12. # Atau (should remain even when close the session)
  13. [System.Environment]::SetEnvironmentVariable('FTP_HOST','10.10.10.147', [System.EnvironmentVariableTarget]::User)
  14. [System.Environment]::SetEnvironmentVariable('FTP_HOST','10.10.10.147', [System.EnvironmentVariableTarget]::Machine)
  15. # Melihat windows variable
  16. $env:FTP_HOST
  17. # Atau
  18. Get-ChildItem Env:FTP_HOST
  19. # Melihat semua windows variable
  20. dir env:
  21. # Atau
  22. Get-ChildItem Env:
  23. # Hapus windows environment variable
  24. $env:FTP_HOST = $null
  25. # Atau (untuk yang persisten)
  26. [Environment]::SetEnvironmentVariable("FTP_HOST", $null ,"User")
  27. [Environment]::SetEnvironmentVariable("FTP_HOST", $null ,"Machine")
  28.  
  29. # enable long path
  30. New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
  31. -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
  32.  
Add Comment
Please, Sign In to add comment