Thursday, 18 September 2008

recursive for loops

problem: for example, reading a text file input, searching for the entry in a database and outputting specified csv's

what im not doing: hitting this with vbs, because vbs is only for when batch cant do it


try it, recursive for loops arent supported in winxp cmd / batch files, but here is a wee workaround

for /f %%a in (list.csv) do call :list %%a
:list
if not %1'==' for /f "tokens=1-5* delims=," %%a in ('findstr /i %1 db') do echo %%~c,%%~d,%%~e >> summary.csv

save the batch and watch it recurse!

winxp sucks again

slightly different post here, but ive not really been on for a while, but got to highlight this!

got
this message and here is the proof


now, you will notice that all of the google results feature either vista or enhanced ie7 issues, generally with network shares, but i got this when trying to extract a file from a compressed archive within another compressed archive, a zip within a zip if you will. now, i know that it was poor practice but that is how the file arrived.

also, do you want to move or copy files from this zone, yes / no? move or copy? yes or no? this is almost nonsensical to me...

Friday, 20 June 2008

update local website with live info

problem: customers stock system doesnt play nice with web, so stock levels and prices are manually updated each morning. local copy of website on sales laptops information can be out by two weeks!

what im not doing: calling in sales reps every day to get up-to-date info


so, vbs to the rescue again. as this is a text file, read into an array by php live it is uploaded using ftp binary type to preserve carriage returns. downloading via ascii should preserve this file characteristic.

on error resume next
url = "onlinepathhere"
path = "localpathhere"
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", url, False
xmlhttp.send()
if xmlhttp.Status = 200 then 'if status is anything other than 200 it is not ready
Set fstemp = CreateObject("Scripting.FileSystemObject")
fstemp.GetFile(path + "pricelist.bak").Delete 'on error statement ensure script carries on if file doesnt exist
fstemp.MoveFile path + "pricelist.dat", path + "pricelist.bak"
Set filetemp = fstemp.CreateTextFile(path + "pricelist", true)
filetemp.write (xmlhttp.responseText)
filetemp.close
else
msgbox "please ensure that you are connected to the internet to update stock figures" + vbcrlf + vbcrlf + "if you are connected please try again later"
end if
wscript.quit()

Wednesday, 18 June 2008

winxp wmi / wbem problems (for no good reason!)

problem: tasklist wont run (dialogue framedyn.dll not found) and the following error in event viewer

The Windows Security Center Service was unable to establish event queries with WMI to monitor third party AntiVirus and Firewall.

what im not doing: an 'inplace reinstall' [edit: i maybe am!]



step 1 - copy framedyn.dll from %windir%\system32\dllcache to %windir%\system32\wbem (as admin)... tasklist runs, but logging out & back in takes us back to problem!

step 2 - run rundll32 wbemupgd, UpgradeRepository to diagnose and repair wmi... wbemupdg module not found... no good!

step 3 - run rundll32.exe setupapi,InstallHinfSection WBEM 132 %windir%\inf\wbemoc.inf, insert winxppro cd then restart... now i have additional warnings along with initial problem!

A provider, HiPerfCooker_v1, has been registered in the WMI namespace, Root\WMI, to use the LocalSystem account. This account is privileged and the provider may cause a security violation if it does not correctly impersonate user requests.

A provider, CmdTriggerConsumer, has been registered in the WMI namespace, Root\cimv2, to use the LocalSystem account. This account is privileged and the provider may cause a security violation if it does not correctly impersonate user requests.

A provider, Rsop Planning Mode Provider, has been registered in the WMI namespace, root\RSOP, but did not specify the HostingModel property. This provider will be run using the LocalSystem account. This account is privileged and the provider may cause a security violation if it does not correctly impersonate user requests. Ensure that provider has been reviewed for security behavior and update the HostingModel property of the provider registration to an account with the least privileges possible for the required functionality.

may have to come back to this one...

Friday, 6 June 2008

remote remote desktop

problem: forgot to enable rdp on domain workstation

what im not doing: driving all the way there to tick a box!


easy, connect to remote registry, navigate to

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server

change

fDenyTSConnections

to

0

Wednesday, 14 May 2008

windows nt command line enable / disable accounts

problem: enabling temp admin account for app specific use (yes, sage again!)

what im not doing: going through the server management console just for this


pretty simple from the command line, but difficult to find and documentation on it

net user tempaccount /active:[yes|no]

picked up that there is also a /time switch for enabling only during certain times, but dont need this just now

Monday, 12 May 2008

ubuntu desktop enviroment summary

problem: keep forgetting this stuff

what im not doing: raking through forums every time i need reference


ubuntu (gnome desktop enviroment)
login manager: gdm
window manager: metacity
file manager: nautilus

kubuntu (kde desktop enviroment)
login manager: kdm
window manager: kwin
file manager: konqueror

xubuntu
login manager: xdm
window manager: xfce(4)
file manager: thunar

can all be mixed / matched / added / removed, but this is the default setup