Month: February 2012

Change Password For Current User – VbScript

ChangePasswordForCurrentUser.vbs Const ADS_UF_PASSWD_CANT_CHANGE = 64 Set WshShell = WScript.CreateObject(“WScript.Shell”) Set oUserEnv = WshShell.Environment(“PROCESS”) userID = oUserEnv(“USERNAME”) If Not IsEmpty(userID) Then Set oADsUser = GetObject(“WinNT://ww-intern/” & userID) WScript.Echo “UserFullName = ” & oAdsUser.Get(“FullName”) lUserFlags = oAdsUser.Get(“userFlags”) If lUserFlags AND ADS_UF_PASSWD_CANT_CHANGE THEN WScript.Echo “User darf Kennwort nicht ändern, das passende Recht wird jetzt gesetzt” lUserFlags = lUserFlags …

Change Password For Current User – VbScript Read More »

jscript terminate process

var objProcess; var colProcess; var strComputer = “.”; var strProcessKill = “‘calc.exe'” var objWMIService = GetObject(“winmgmts:\\.\root\CIMV2”); var colProcess = objWMIService.ExecQuery (“Select * from Win32_Process Where Name = ” + strProcessKill ) var enumItems = new Enumerator(colProcess); for (; !enumItems.atEnd(); enumItems.moveNext()) { var objItem = enumItems.item(); objItem.Terminate() WScript.Echo(“fund” ); } WScript.Echo(“Just killed process ” + strProcessKill …

jscript terminate process Read More »

automation – jscript http client

Need do download a file via HTTP on a Windows-Server? Here is a how-to. var xmlhttp = new ActiveXObject(“Microsoft.XMLHTTP”); xmlhttp.open(“GET”, ‘http://www.nikem.de/Willkommen_files/chart1.jpg’, false); xmlhttp.send(null); var adTypeBinary = 1 var adSaveCreateOverWrite = 2 var BinaryStream = new ActiveXObject(“ADODB.Stream”); //Specify stream type – we want To save binary data. BinaryStream.Type = adTypeBinary //Open the stream And write binary …

automation – jscript http client Read More »

Martin Rocks