Windows: Difference between revisions
Jump to navigation
Jump to search
(→gc) |
|||
Line 51: | Line 51: | ||
==start-service== | ==start-service== | ||
start-service ipeventwatcher | start-service ipeventwatcher | ||
==ac== | |||
Add content to file. This example creates a md5sum command. | |||
ac c:\temp\md5sum.ps1 'function Get-Checksum([string]$strInFile)' | |||
ac c:\temp\md5sum.ps1 '{' | |||
ac c:\temp\md5sum.ps1 ' $objCrypto = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"' | |||
ac c:\temp\md5sum.ps1 ' $objFile = Get-Item $strInFile' | |||
ac c:\temp\md5sum.ps1 ' $objStream = $objFile.OpenRead()' | |||
ac c:\temp\md5sum.ps1 ' $objBytes = $objCrypto.ComputeHash($objStream)' | |||
ac c:\temp\md5sum.ps1 ' $strChecksum = ""' | |||
ac c:\temp\md5sum.ps1 ' foreach($objByte in $objBytes)' | |||
ac c:\temp\md5sum.ps1 ' {' | |||
ac c:\temp\md5sum.ps1 ' $strChecksum += $objByte.ToString("x2")' | |||
ac c:\temp\md5sum.ps1 ' }' | |||
ac c:\temp\md5sum.ps1 ' $objStream.Close() | Out-Null' | |||
ac c:\temp\md5sum.ps1 ' return $strChecksum' | |||
ac c:\temp\md5sum.ps1 '}' | |||
ac c:\temp\md5sum.ps1 '' | |||
ac c:\temp\md5sum.ps1 '$strFileToCheck = $args[0]' | |||
ac c:\temp\md5sum.ps1 'if(Test-Path($strFileToCheck))' | |||
ac c:\temp\md5sum.ps1 '{' | |||
ac c:\temp\md5sum.ps1 ' Get-Checksum $strFileToCheck' | |||
ac c:\temp\md5sum.ps1 '}' |
Revision as of 09:37, 13 December 2013
Configure network
- Static ip.
netsh interface ip set address name="Local Area Connection" static 192.168.122.41 255.255.255.0 192.168.122.1 1
- Dhcp
netsh interface is set address name="Local Area Connection" dhcp
- extract msi
msiexec /a "C:\software.msi" /qb TARGETDIR="C:\Folder"
restart network
route -f ipconfig /release ipconfig /renew arp -d * nbtstat -R nbtstat -RR ipconfig /flushdns ipconfig /registerdns
Profile
- Profile
C:\Users\abjorklund\AppData\Roaming\Microsoft\Windows\Start Menu
restart via rdesktop
CTRL + ALT + END
alternative shutdown
Shutdown with restart
shutdown /t 0 /r /f
Shutdown
shutdown /t 0 /s /f
change password
Start a command prompt as administrator.
net user username password
is your account locked. bat file
@echo off :again date /t & time /t net user /domain mdinkel > c:\temp\mdinkel find "active" c:\temp\mdinkel timeout 10 goto again
PowerShell
gc
Get content. Print content of file.
gc c:\temp\file.txt
restart-service
restart-service ipeventwatcher
get-service
get-service ipeventwatcher
stop-service
stop-service ipeventwatcher
start-service
start-service ipeventwatcher
ac
Add content to file. This example creates a md5sum command.
ac c:\temp\md5sum.ps1 'function Get-Checksum([string]$strInFile)' ac c:\temp\md5sum.ps1 '{' ac c:\temp\md5sum.ps1 ' $objCrypto = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"' ac c:\temp\md5sum.ps1 ' $objFile = Get-Item $strInFile' ac c:\temp\md5sum.ps1 ' $objStream = $objFile.OpenRead()' ac c:\temp\md5sum.ps1 ' $objBytes = $objCrypto.ComputeHash($objStream)' ac c:\temp\md5sum.ps1 ' $strChecksum = ""' ac c:\temp\md5sum.ps1 ' foreach($objByte in $objBytes)' ac c:\temp\md5sum.ps1 ' {' ac c:\temp\md5sum.ps1 ' $strChecksum += $objByte.ToString("x2")' ac c:\temp\md5sum.ps1 ' }' ac c:\temp\md5sum.ps1 ' $objStream.Close() | Out-Null' ac c:\temp\md5sum.ps1 ' return $strChecksum' ac c:\temp\md5sum.ps1 '}' ac c:\temp\md5sum.ps1 ac c:\temp\md5sum.ps1 '$strFileToCheck = $args[0]' ac c:\temp\md5sum.ps1 'if(Test-Path($strFileToCheck))' ac c:\temp\md5sum.ps1 '{' ac c:\temp\md5sum.ps1 ' Get-Checksum $strFileToCheck' ac c:\temp\md5sum.ps1 '}'