Mar
27
Posted by jbjorkman on March 27, 2010 under
Deprecated: preg_replace() [
function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in
/var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php on line
82
Windows
Show available wireless networks using netsh (Provides more info than GUI):
netsh wlan show networks mode=bssid
Mar
26
Posted by jbjorkman on March 26, 2010 under
Powershell
Powershell command to replace a line of text in files recursively, in this example we disable bitmap cache in all Default.rdp files
gci "C:\Documents and Settings" -recurse -force -filter default.rdp | % { Set-Content $_.FullName ((gc $_.fullname) -replace "bitmapcache.*","bitmapcachepersistenable:i:0" )}
Mar
19
Posted by jbjorkman on March 19, 2010 under
Windows
Use the following command to list MS DNS Server cache entries:
dnscmd DNS_Server_IP /enumrecords /cache domainname
Use /detail for additional info
Mar
16
Posted by jbjorkman on March 16, 2010 under
VBScript
Option Explicit
Const HKLM = &H80000002
Dim oShell, oReg, oWMI, aryNICs, oNIC, strNICName, strNICId, intPNPCap, intNewPNPCap,strResultSet oShell = WScript.CreateObject("Wscript.Shell")
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set aryNICs = oWMI.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each oNIC in aryNICs
strNICid=Mid(oNIC.Caption,6,4)
strNICName=Mid(oNIC.Caption,12,len(oNIC.Caption)-10)
oReg.GetDWORDValue HKLM, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & strNICid & "\","PnPCapabilities",intPNPCap
if (intPNPCap and 56)=56 then
strResult=strResult & "Powersaving already disabled for " & strNICName & vbCRLF
else
oReg.SetDWORDValue HKLM, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & strNICid & "\","PnPCapabilities",(intPNPCap or 56)
oReg.GetDWORDValue HKLM, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & strNICid & "\","PnPCapabilities",intNewPNPCap
if intNewPNPCap=intPNPCap then
strResult=strResult & "Couldn't change settings for " & strNICName & vbCRLF
else
strResult=strResult & "Disabling Powersave for " & strNICName & "(" & intPNPCap & ">" & intNewPNPCap & ")" & vbCRLF
end if
end if
Next
oShell.popup strResult,10,"Disabe NIC Powersaving",64
Set oReg = Nothing
Set oWMI = Nothing
Mar
03
Posted by jbjorkman on March 3, 2010 under
Windows
Example of createing a counter eventlog from commandline using logman
md d:\Perflogs
cacls d:\perflogs /e /g "NT AUTHORITY\NETWORK SERVICE":C
logman create counter PerfLog2010 -o D:\Perflogs\ -rf 168:0:0 -si 0:0:15 -f bin -max 512 -v mmddhhmm
logman update PerfLog2010 -c "\Processor(_Total)\% Processor Time" "\Processor(_Total)\Interrupts/sec" "\System\Processor Queue Length" "\System\Context Switches/sec" "\Memory\Available MBytes" "\Memory\Pages Input/sec" "\PhysicalDisk(_Total)\Avg. Disk Queue Length" "\Process(_Total)\Working Set"