User Tools

Site Tools


powershell

This is an old revision of the document!


PowerShell

Вывод значения переменной

PS C:\> $newPassword="Pa$$w0rd"

PS C:\> $newPassword='Pa$$w0rd'

PS C:\> Write-Output $newPassword

Добавление в домен пользователей

New-ADUser -Name "Ivan I. Ivanov" -DisplayName "Ivan I. Ivanov" -GivenName "Ivan" -Initials "I" -Surname "Ivanov" `
-SamAccountName "user1" -AccountPassword(ConvertTo-SecureString -AsPlainText 'Pa$$w0rd1' -Force) `
-Enabled $true -ChangePasswordAtLogon $false

New-ADUser -Name "Petr P. Petrov" -DisplayName "Petr P. Petrov" -GivenName "Petr" -Initials "P" -Surname "Petrov" `
-SamAccountName "user2" -AccountPassword(ConvertTo-SecureString -AsPlainText 'Pa$$w0rd2' -Force) `
-Enabled $true -ChangePasswordAtLogon $false

New-ADUser -Name "Sidor S. Sidorov" -DisplayName "Сидор Сидорович Сидоров" -GivenName "Sidor" -Initials "S" -Surname "Sidorov" `
-SamAccountName "user3" -AccountPassword(ConvertTo-SecureString -AsPlainText 'Pa$$w0rd3' -Force) `
-Enabled $true -ChangePasswordAtLogon $false

Список установленного ПО

powershell -Command Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall; 

powershell -Command Get-ChildItem HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

  или, с форматированием

powershell -command "Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, EstimatedSize, InstallDate | Format-Table -AutoSize" 

powershell -command "Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, EstimatedSize, InstallDate | Format-Table -AutoSize"

  или еще 2 варианта:)
  
powershell -command "Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Get-ItemProperty | Where-Object 'DisplayName' | Sort-Object -Property DisplayName | Select-Object -Property DisplayName | Format-Table -AutoSize -HideTableHeaders"
powershell -command "Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Get-ItemProperty | Where-Object 'DisplayName' | Sort-Object -Property DisplayName | Select-Object -Property DisplayName | Format-Table -AutoSize -HideTableHeaders"

powershell -command "Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Get-ItemProperty | Where-Object 'DisplayName' | Sort-Object -Property DisplayName | Select-Object DisplayName, DisplayVersion, Publisher, EstimatedSize, InstallDate | Format-Table -AutoSize"
powershell -command "Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Get-ItemProperty | Where-Object 'DisplayName' | Sort-Object -Property DisplayName | Select-Object DisplayName, DisplayVersion, Publisher, EstimatedSize, InstallDate | Format-Table -AutoSize"
powershell.1665601266.txt.gz · Last modified: 2022/10/12 22:01 by val