I have just experienced a problem while trying to read a text file by vbscript.
When I echo lines to screen I saw an empty line shows ÿþ, an...
Const ForReading = 1
Const TristateUseDefault=-2
Dim objFSO
Set objFile = objFSO.OpenTextFile("C:\WDSPendingDevices.txt", ForReading, True, TristateUseDefault)
Osman Shener's Blogs and Articles (EN): VBScript : OpenTextFile Weird/Bad Characters:
Saturday, January 28, 2012
Thursday, December 22, 2011
Update teh Active Directory terminal Session Properties
Set objParent = GetObject("ldap://OU=Level/ 02,OU=Security - Administrator Accounts,DC=XenWorld")
objparent.Filter = Array("user")
for each objUser in objParent
Wscript.Echo "Modifying|" & objUser.Get("CN")
'SESSIONS ATTRIBUTES
objUser.MaxDisconnectionTime = 2880 'In Minutes
objUser.MaxIdleTime = 2880 'In Minutes
objUser.MaxConnectionTime= 0 'active connections okay
objUser.BrokenconnectionAction = 0 '0=Disconnect, 1=End
objUser.SetInfo
next
Details on more properties:
http://www.virtualizationadmin.com/articles-tutorials/terminal-services/scripting/scripting-server-based-computing-terminal-services-attributes-active-directory-user-objects.html
objparent.Filter = Array("user")
for each objUser in objParent
Wscript.Echo "Modifying|" & objUser.Get("CN")
'SESSIONS ATTRIBUTES
objUser.MaxDisconnectionTime = 2880 'In Minutes
objUser.MaxIdleTime = 2880 'In Minutes
objUser.MaxConnectionTime= 0 'active connections okay
objUser.BrokenconnectionAction = 0 '0=Disconnect, 1=End
objUser.SetInfo
next
Details on more properties:
http://www.virtualizationadmin.com/articles-tutorials/terminal-services/scripting/scripting-server-based-computing-terminal-services-attributes-active-directory-user-objects.html
Tuesday, December 20, 2011
Extract Details about your Site Links
Import-Module ActiveDirectory
$ConfigPath = (Get-ADRootDSE).configurationNamingContext
Get-ADObject -Filter 'ObjectClass -eq "siteLink"' -SearchBase $ConfigPath -Properties * | Format-Table Name, replInterval, cost, siteList -AutoSize
From:
http://blogs.technet.com/b/ashleymcglone/archive/2010/10/06/powershell-to-automatically-create-all-ad-hub-to-spoke-site-links.aspx
Bonus Link
http://blogs.technet.com/b/ashleymcglone/archive/2011/06/29/report-and-edit-ad-site-links-from-powershell-turbo-your-ad-replication.aspx
$ConfigPath = (Get-ADRootDSE).configurationNamingContext
Get-ADObject -Filter 'ObjectClass -eq "siteLink"' -SearchBase $ConfigPath -Properties * | Format-Table Name, replInterval, cost, siteList -AutoSize
From:
http://blogs.technet.com/b/ashleymcglone/archive/2010/10/06/powershell-to-automatically-create-all-ad-hub-to-spoke-site-links.aspx
Bonus Link
http://blogs.technet.com/b/ashleymcglone/archive/2011/06/29/report-and-edit-ad-site-links-from-powershell-turbo-your-ad-replication.aspx
Labels:
active directory,
sites and services,
techblog
Cool Script to dump Sites and Services
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites | select name, @{n='subnets';e={$_.subnets | select -expand name}}, @{n='servers';e={$_.Servers | select -expand name}}, @{n='sitelink';e={$_.sitelinks | select -expand name}} | export-csv c:\temp\sites.csv
from
http://www.powershellcommunity.org/Forums/tabid/54/aft/6321/Default.aspx
from
http://www.powershellcommunity.org/Forums/tabid/54/aft/6321/Default.aspx
Monday, October 31, 2011
XenApp 4.5 Summary Database Query stuff
Thanks to XENWIZ for the most of the code, SQL Query which I then export to CSV.
Point to Summary Database
Modify date
Grab important stuff like appname, server, clientname, username, start time
SELECT LU_APPNAME.APPNAME,LU_SERVERNAME.SERVERNAME, SDB_SESSION.SESSIONSTART, SDB_SESSION.SESSIONEND, LU_CLIENT.CLIENTNAME, LU_USER.USERNAME
FROM
LU_APPNAME, SDB_SESSION, LU_USER, LU_SERVERNAME, LU_SERVER, LU_CLIENT
WHERE
LU_APPNAME.PK_APPNAMEID = SDB_SESSION.FK_APPNAMEID
AND LU_USER.PK_USERID = SDB_SESSION.FK_USERID
AND SDB_SESSION.FK_SERVERID = LU_SERVER.PK_SERVERID
AND LU_SERVERNAME.PK_SERVERNAMEID = LU_SERVER.FK_SERVERNAMEID
AND SDB_SESSION.FK_CLIENTID = LU_CLIENT.PK_CLIENTID
AND LU_CLIENT.CLIENTNAME != 'Console'
AND SDB_SESSION.SESSIONSTART Between '2011-10-27 14:00:00.000' and '2011-10-28 14:00:00.000'
ORDER BY SDB_SESSION.SESSIONSTART
Point to Summary Database
Modify date
Grab important stuff like appname, server, clientname, username, start time
SELECT LU_APPNAME.APPNAME,LU_SERVERNAME.SERVERNAME, SDB_SESSION.SESSIONSTART, SDB_SESSION.SESSIONEND, LU_CLIENT.CLIENTNAME, LU_USER.USERNAME
FROM
LU_APPNAME, SDB_SESSION, LU_USER, LU_SERVERNAME, LU_SERVER, LU_CLIENT
WHERE
LU_APPNAME.PK_APPNAMEID = SDB_SESSION.FK_APPNAMEID
AND LU_USER.PK_USERID = SDB_SESSION.FK_USERID
AND SDB_SESSION.FK_SERVERID = LU_SERVER.PK_SERVERID
AND LU_SERVERNAME.PK_SERVERNAMEID = LU_SERVER.FK_SERVERNAMEID
AND SDB_SESSION.FK_CLIENTID = LU_CLIENT.PK_CLIENTID
AND LU_CLIENT.CLIENTNAME != 'Console'
AND SDB_SESSION.SESSIONSTART Between '2011-10-27 14:00:00.000' and '2011-10-28 14:00:00.000'
ORDER BY SDB_SESSION.SESSIONSTART
The 'console' connection was causing my stats be a bit loopy.
also get a few blank appnames which I should exclude.
Thursday, October 20, 2011
RDP Black Logons
we had a Win2k3 server crashed due to not enough hard disk space.
[HKEY_USERS\.DEFAULT\Control Panel\Colors]
All values for the keys were 0 0 0 (black).
set back to defaults, and we were back working
thanks to esoltan + google for the fix
[HKEY_USERS\.DEFAULT\Control Panel\Colors]
All values for the keys were 0 0 0 (black).
set back to defaults, and we were back working
thanks to esoltan + google for the fix
Subscribe to:
Posts (Atom)