unix:
grep -R 'bruce'
Powershell
Get-ChildItem D:\path -recurse | Select-String -pattern 'bruce' | group path | select name
$ Get-ChildItem -Path d:/path -Filter 'installation.log' -Recurse | select-string 'successful' -list
unix:
todo
Powershell
Get-Content filename -Encoding Byte | Select-Object -Index (1000..2000) | FOREACH {WRITE-HOST –object ([CHAR]$_) –nonewline }
unix:
echo 'YnJ1Y2UK' | base64 bruce
Powershell
[System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String('YnJ1Y2UK'))
bruce
Powershell
Get-Module -ListAvailable | `
foreach {"`r`nmodule name: $_"; "`r`n";gcm -Module $_.name -CommandType cmdlet, function | select name}
Powershell
Get-Partition -DriveLetter G | %{Update-disk $_.DiskNumber}
Resize-Partition -DriveLetter G -Size $(Get-PartitionSupportedSize -DriveLetter G).SizeMax
Powershell
[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.IO.File]::ReadAllText('text')))
YnJ1Y2UNCg==
[System.Text.Encoding]::ASCII.GetString([System.Convert]::FromBase64String('YnJ1Y2UNCg=='))
bruce
Powershell
$host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(180,500)
$node = configuration.etl.dbDateFormat
$key = "format"
$value = 'yyyy-MM-dd'
$conf_path = "path/to/file.xml";
$conf = [xml](Get-Content $conf_path);
$entry = $conf.$node;
if($entry) {
$entry.SetAttribute("$key", "$value");
} else {
$entry = $conf.CreateNode("$node");
$entry.SetAttribute("Key", "$key");
$entry.SetAttribute("Value", "$value");
$conf.Configuration_list.AppendChild($entry);
}
$conf.Save($conf_path);
Start-process powershell -windowstyle Hidden -Verb runAs "$cmd"
And add it to Administrators and Remote desktop users
new-localuser UserName -password $(convertto-securestring xxxxxxxxx -AsPlainText -Force)
add-localgroupmember -group 'Administrators' -Member UserName
add-localgroupmember -group 'Remote Desktop Users' -Member UserName
gci 'C:\Program Files\Apache Software Foundation\tomcat\' -filter 'tomcat8-stderr.*' -recurse | gc -tail 100
get-process AISSrv | Group-Object -Property ProcessName,Id | `
Format-Table Name, @{n='Phys Mem Alloc (MB)';e={'{0:N0}' -f (($_.Group|Measure-Object WorkingSet64 -Sum).Sum / 1KB)};a='right'} -AutoSize