Tuesday, November 9, 2010

Appsense and Citrix

Working with Appsense. It seems great.. just have to figure out how it works.. lol

Seems this link is pretty helpful...

Still need more doco that goes deeper into the config and concept of Appsense.

More to come...

Friday, November 5, 2010

VBscript for getting Computer Model using WMI system class

' Computer System Model
' -------------------------------------------------------'
Option Explicit
Dim objWMIService, objComputer, colComputer
Dim strComputer
'strComputer = "."
strcomputer = InputBox("Enter the PC Name")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer in colComputer
Wscript.Echo "System Name: " & objComputer.Name
Wscript.Echo "Model " & objComputer.Model


' Enjoy

Saturday, October 16, 2010

Windows error when logging on - a problem is preventing windows from accurately checking the license for this computer. error code

Register the following DLL s

They should be in the %system root% \ system32 folder

just type the following statements one by one, hit ENTER after each, of course:

regsvr32 licwmi.dll

regsvr32 regwizc.dll

regsvr32 licdll.dll

Friday, October 8, 2010

DHCP not updating DNS records, 31,DNS Update Failed -1

After checking every possible reason of DHCP not taking care Dynamic DNS updates... it turns out that there is a memory leak on the dhcp service when DDNS is enabled on that Server.
You need to kill tcpsvcs.exe from task manager to restart it properly and it will starting working temporarily till it starts using high mem again(develops the leak again)

MS recommended hotfix

Ofcourse you got check your DHCP and DNS config are correct for DDNS

For some reason after replacing an Old DC / DHCP server, the DNS updates keep failing

31,10/03/10,11:32:42,DNS Update Failed,,computername.contoso.microsoft.ad,-1,

Tried everything that was recommended on all forums and technet and MS support website.
Checked permissions, checked the service account for DHCP update.

No Joy........

Part of the problem was security permission and the fact that there were not corresponding Reverse Lookup Zones created for the corresponding subnets.
Created the Reverselookup Zones. Gave write, read and child object permissions to the DHCP service account responsible for DNS updates.

Still wouldnt work...

Then I came across DNSCMD
Compared the info against a DHCP server that was updating DNS records fine.
DNSCMD /Info on both servers.

The only difference i found was the Listen Address missing on the DHCP server that wasnt working.
Below is the output of both:
Working DHCP Server: (dnscmd /info output)
Addr Count = 1

Addr[0] =>

Addr Count = 1

Addr[0] =>

Addr Count = 1

Addr[0] =>

forward timeout = 5
slave = 0
Command completed successfully.

Non-Working DHCP Server: (dnscmd /info output)
Addr Count = 1

Addr[0] =>

NULL IP Array.

Addr Count = 2

Addr[0] =>

Addr[1] =>

forward timeout = 5
slave = 0
Command completed successfully.

After fixing the listen address using the command
dnscmd /resetlistenaddresses (ipaddress of the dhcp server itself)

However, that didnt fix it either, Until

I killed the DHCP server process tpcsvc.exe using process explorer.
Reason: I remember coming across a MS article saying that if the DNS update process failed at one the consecutive requests would fail until the queue is cleared.

Restarted the DHCP server service manually again.
Then ran ipconfig /renew on client pcs and Voila... it worked FINALLY.

hope it helps whoever reads this..



Tuesday, September 14, 2010

Monday, July 12, 2010

Export Mailbox to PST, Exchange 2007

Need to install outlook client on the box you want to run the script on.

EXCTOPST.bat file ---->
@echo off
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\Microsoft\bin\exshell.psc1" -command C:\Scripts\user.ps1
user.ps file......
$id = read-host "Enter the username"
$PSTPath = read-host "Enter the pst pathname E:\Temp\"
get-mailbox -identity $id | Export-Mailbox -PSTFolderPath $PSTPath
Write-host -fore Yellow "Check the STATUS MESSAGE to see if successfull or any errors have occured. Then PRESS ANY KEY to Continue"

Thursday, April 29, 2010

"DHCP...." followed by "PXE-E53: No boot filename received"


When being started, the PXE client comes up with the PXE copyright message, then displays


After a while, the following error message is displayed:

PXE-E53: No boot filename received

Depending on the PXE client's system setup boot device list configuration, the PC then either stops or tries to boot from the next boot device in the system setup boot device list.


The "PXE-E53" error indicates that the PXE client received a reply to its DHCPDISCOVER message, but the "boot filename" information was missing in this reply.


Make sure that the "boot filename" option is present on your DHCP or BOOTP server, and that its value is set to the filename of the boot loader.

When using Microsoft DHCP server, add option 067 (Bootfile Name) to your scope. When using a Unix/Linux based (ISC) DHCP server, use the "filename" parameter for this purpose.

In the context of the BootManage Administrator, the boot loader filename is "pxboot" for PXE clients and "bpboot" for TCP/IP BOOT-PROM clients. So, if you have exclusively PXE clients, set the boot filename option to the value "pxboot". If you have exclusively TCP/IP BOOT-PROM clients, set the boot filename option to the value "bpboot". In a mixed PXE and TCP/IP BOOT-PROM client environment, you must configure your DHCP or BOOTP server so that it provides the PXE clients with the "pxboot" boot loader, and the TCP/IP BOOT-PROM clients with the "bpboot" boot loader.

____ IMPORTANT Thing to note:

We were trying to troubleshoot the above issue with the recommendation above, however, make sure you can see the dhcp server leasing out the ips to the machine you are trying to pxe boot.
Secondly and most important, if they are 64 bit client, run the command below on the server.
WDSUTIL /set-server /architecturediscovery:yes

Hope you dont have to struggle after that..


Saturday, April 24, 2010

Group Membership script

Hi All,

Below script will fetch you the membership details of the AD group you pass it as a parameter.


groupname = Wscript.Arguments(0)
'groupName = inputbox("Please enter the name of the group:")
'dim FileName = Groupname
if groupName = "" then
end if

groupPath = getgrouppath(groupName)

if groupPath = "" then
wscript.echo "Unable to find the specified group in the domain"
end if
set objGroup = getobject(grouppath)
set objFSO = createobject("scripting.filesystemobject")
set objFile = objFSO.createtextfile(groupname)
q = """"
for each objMember in objGroup.Members
'***** Users who's primary group is set to the given group need to be enumerated seperatly.*****
getprimarygroupmembers groupname
wscript.echo "Completed"
function getGroupPath(byval GroupName)
set cmd=createobject("ADODB.Command")
set cn=createobject("ADODB.Connection")
set rs=createobject("ADODB.Recordset")
cn.open "Provider=ADsDSOObject;"
cmd.commandtext = "SELECT adspath from 'LDAP://" & getnc & _
"' WHERE objectCategory = 'Group' and sAMAccountName = '" & groupname & "'"
cmd.activeconnection = cn
set rs = cmd.execute
if rs.bof <> true and rs.eof<>true then
getgrouppath = ""
end if
end function
function getNC
set objRoot=getobject("LDAP://RootDSE")
end function
function getPrimaryGroupMembers(byval GroupName)
set cn = createobject("ADODB.Connection")
set cmd = createobject("ADODB.Command")
set rs = createobject("ADODB.Recordset")
cn.open "Provider=ADsDSOObject;"
'***** Change the Page Size to overcome the 1000 record limitation *****
cmd.properties("page size")=1000
cmd.commandtext = "SELECT PrimaryGroupToken FROM 'LDAP://" & getnc & _
"' WHERE sAMAccountName = '" & GroupName & "'"
set rs = cmd.execute
if rs.eof<>true and rs.bof<>true then
PrimaryGroupID = rs(0)
Err.Raise 5000, "getPrimaryGroupMembers", "Unable to find PrimaryGroupToken property"
end if
cmd.commandtext = "SELECT samaccountname, sn, givenName FROM 'LDAP://" & getNC & _
"' WHERE PrimaryGroupID = '" & PrimaryGroupID & "'"
set rs = cmd.execute
while rs.eof<>true and rs.bof<>true
objFile.WriteLine(q & rs("samaccountname") & q & "," & q & rs("sn") & q & _
"," & q & rs("givenName") & q)
end function

Tuesday, April 20, 2010

Backup NTFS permissions

Reference : _h_t_t_p_://ochoco.blogspot.com/2009/02/quick-tip-back-up-your-ntfs-security.html

_________Adding a security group to a folder and maintain inheritance_________
C:\Program Files\Support Tools>icacls D:\data$\NTFS_PermTEST /Grant "domainname\
(Be mindful of security group names... has to be prewindows 2000 name for groups)



Here is example syntax that you can use to proactively back up your NTFS permissions:

Subinacl /noverbose /output=c:\ntfs_perms.txt /subdirectories "Path to the Folder of NTFS permissions we have to Backup"

To backup the permissions of the folder, subfolders and files on folder called Data\IT on the D: drive:

subinacl /noverbose /output=c:\ntfs_perms_TEST.txt /subdirectories D:\data\IT

If you wanted to just backup the NTFS permissions for the entire drive, the command would look like this:

subinacl /noverbose /output=c:\ntfs_D_drive_perms.txt /subdirectories D:\*.*

Most of you will probably not be concerned with backing up down to the file level, and are satisfied with just backing up the permissions at the directory level. Backing up the permissions for just the directories can be achieved with the following syntax:

subinacl /noverbose /output=c:\D_drive_NTFSperms.txt /subdirectories=directoriesonly D:\*.*

The output of the command while have something like this:
Elapsed Time: 00 00:00:00
Done: 5, Modified 5, Failed 0, Syntax errors 0
Last Done : D:\data$\IT\NTFS_PermTEST\TestA\Test_A_2\Inherit_notAllowed

The contents of the file created by subinacl are viewable in any text editor and the output is similar to this:
+File D:\data$\NTFS_PermTEST\TestA
/owner =builtin\administrators
/primary group =domainname\domainname users
/audit ace count =0
/perm. ace count =5
/pace =domainname\A.B Type=0x0 Flags=0x13 AccessMask=0x1301bf
/pace =domainname\domainname admins Type=0x0 Flags=0x13 AccessMask=0x1f01ff
/pace =domainname\gav Type=0x0 Flags=0x13 AccessMask=0x1200a9
/pace =domainname\gsg-information technology Type=0x0 Flags=0x13 AccessMask=0x1f01ff
/pace =domainname\rahul Type=0x0 Flags=0x13 AccessMask=0x1f01ff

+File D:\data$\NTFS_PermTEST\TestB
/owner =builtin\administrators
/primary group =domainname\domainname users
/audit ace count =0
/perm. ace count =5
/pace =domainname\A.B Type=0x0 Flags=0x13 AccessMask=0x1301bf
/pace =domainname\domainname admins Type=0x0 Flags=0x13 AccessMask=0x1f01ff
/pace =domainname\gav Type=0x0 Flags=0x13 AccessMask=0x1200a9
/pace =domainname\gsg-information technology Type=0x0 Flags=0x13 AccessMask=0x1f01ff
/pace =domainname\rahul Type=0x0 Flags=0x13 AccessMask=0x1f01ff

To restore the permissions on the drive using the file that you backed them up to:

Subinacl /playfile c:\D_drive_NTFS_perms.txt

Monday, April 19, 2010

Simple explanation to Win2003 AD groups

Reference: _h_t_t_p_://www.computerperformance.co.uk/Litmus/universal_groups.htm

Amateurs: Use only Universal Groups and never Global or Domain Local

What are the two TYPES of Groups in Windows Server 2003? Hang on Guy, I thought there were three, Global, Domain Local, and Universal? Microsoft are playing games with words, the two TYPES of groups are Security and Distribution (as in Distribution List).

Microsoft have introduced the Scope attribute to explain the capabilities of groups. If you are brand new to groups it makes sense, but for old timers it takes a while to get your head around the scope concept.

Active Directory Training

As an MCT trainer, I can thoroughly recommend TrainSignal because they provide practical hands on training. In particular, I like the way that TrainSignal cover all learning methods, instructor lead, video and of course text material. You can either take one module, for example Active Directory or go for a combination of modules. See more about Active Directory training
Domain Local Groups (These used to be plain Local groups).

Think of domain local groups as great hosts, literally anyone can be a member, users, Global groups, Universal groups, even computers can join a domain local group. Local groups are bad travellers and only operate in their own domain.

Best practice is to use local groups to assign permissions to resources like databases and printers.

Global Groups

These are great travellers, they can wander the entire Forest. The key point is that global groups are poor hosts and can only contain members from their own domain.

Best practice is to make global group your default group, and for starters, make a group to represent each of your departments.

Universal Groups

Another question for you, why is it sometimes the radio button against create Universal group is greyed out? The answer is when the Domain is in mixed mode you cannot create universal groups (NT 4.0 BDC's would not understand them). You need to 'raise domain level to Windows 2000 native before you benefit from universal groups. Think of universal groups as the ultimate container for nesting groups. They are good hosts and great travellers.

Best practice is make it rule to only include global groups inside Universal groups, no individual groups.

Global Catalog Implications

As you would expect, domain local and global groups are listed in the global catalog, however the individual members are not listed. So changes in global group membership have zero impact on global catalog replication traffic.

Universal groups on the other hand, not only are listed in the global catalog but also the individual users or nested groups are also listed. Now you can see that adding users to a universal group will generate replication traffic. That is why Guy says only put global groups inside universal groups, the individual members inside the global groups are not replicated.

In Windows 2000 the situation is that one change of membership to a universal group causes the whole list to be replicated, thankfully that changed in Server 2003, now only incremental changes are replicated not the whole list.

Thursday, April 15, 2010

Monday, April 12, 2010

connect to windows share from ESX Server

you need to be in the 'bin' directory to run this

First you need to enable samba services on your ESX server’s firewall:

(from the ESX server console)

esxcfg-firewall -e smbClient

Create location on the esx server to mount the share to.

for e.g. mkdir /home/test

enable netfs – netfs is a file system interface to the networking stack of the ESX OS

chkconfig netfs on
service netfs start

mount -t smbfs -o username=,password= //servername/sharename /vmimages/iso

user domain\username format if need be.

Saturday, April 3, 2010

Open two excel sheets and split them across two monitors

Thanks to...

Folder options -> File types tab ->
Select XLS -> Advanced -> Select OPEN -> add space and "%1" at the end of the string in
'Application used to perform action' field.
UNSelect USE DDE.... ok out of everything.

The above steps should enable you to split excel files across two monitors.

WIN 7 does not have FILE Types tab..... Win 7... this was not my idea... ;-)


Thursday, March 18, 2010



Sometimes you would like to use your external USB drive to backup (transfer) your VMDK files directly from your ESX Server external USB drive. VMDK files are files with extention *.VMDK and those files are virtual hard disks of your virtual machines. You can also mount VMDK files directly into your Windows PC.

When you plug-in external USB drive to ESX host you need to enter some commands at the console. For those of you who don’t really know linux, there is some commands to remember. But they are not many…. -:) .

First of all you should know that not all filesystems are supported. For the supported ones there are those here:

* FAT32 read/write.
* Ext3 read/write
* NTFS read only (that means that you can’t use NTFS formated USB drives to copy your VMDK files, but you should create a partition with EXT3 or FAT32)

Now how-to copy data from Service Console to a USB device:

1. Plugin the external USB drive to your ESX host.
2. Run this command to find out to which device name the kernel assigned to it:

tail /var/log/dmesg

3. Now you will have to Run the following command to create a mount point (A mount point is a directory which a device or partition is attached to):

mkdir /mnt/usb


4. Run the following command to mount the drive ( When mounting, you must tell the mount command what is the device or partition you want to mount and what is the mount point. The mount point must be a directory that already exists on your system.:

mount /dev/[device_name] /mnt/usb -t [filesystem_type]

Please Note that you must:
* Replace [device_name] with your device name found in step 2
* Replace [filesystem_type] with vfat (FAT32) or ext3

5. After your copy(backup) you can type this command to unmount the device:

umount /dev/[device_name]

You might also want to export you VMDK files. Vmkstools is VMware ESX Server file system management tool. It is a program for creating and manipulating virtual disks, file systems, logical volumes and pyhsical storage device on the VMware ESX Server. Now what you need to do to export the VMDK (virtual disk)? You will use a command ‘vmfkstools’:

vmkfstools -i /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk /mnt/usb/[vm_name].vmdk -d 2gbsparse

And how-to import the VMDK (virtual disk):

vmkfstools -i /[path_to_USB_mount]/[vm_name].vmdk /vmfs/volumes/[datastore_name]/[vm_name]/[vm_name].vmdk

You might also want to copy the configuration files for a virtual machine. Those files are files with following extentions: *.vmx *.log *.nvram *.vmxf *.vmsd (you will not only copy the configuration files, but at the same time you will make a zip file in tar.gz format:

cd /vmfs/volumes/[datastore_name]/[vm_name]
tar -czvf [vm_name].tar.gz *.vmx *.log *.nvram *.vmxf *.vmsd
cp [vm_name].tar.gz /mnt/usb

Now you will be able to extract the configuration files of a virtual machine:

tar -xzvf [vm_name].tar.gz /vmfs/volumes/[datastore_name]/[vm_name]

Friday, March 5, 2010

Services.exe using up all your memory ? and windows hangs after launch?

I have faced an issue today, where one of the servers kept showing 100% CPU usage and after investigation it turned out to be services.exe taking up most of the cpu time.

After reading few forums, followed a suggestion by someone, to delete all logs from event logs.

This is the reasoning:

Whenever Windows recognises any failure either software/Hardware it makes a entry in the system log. And when you start your machine again this system log entry will be checked and Windows will try to search for a possible solution / or try to analyse the causes of failure.How to check this..

Click ctrl + alt + del – Open your task manager and click processes. And see how much memory the process services.exe is using, If it exceeds say 10%, you can be sure you are having the diagnostic problem.In the below picture the services.exe is running normally.

I did try the above option. and it did make a difference to the performance.
However, before i deleted the logs i found lot of the below warnings under app logs.

Event Type: Warning
Event Source: EvntAgnt
Event Category: None
Event ID: 3006
Date: 5/03/2010
Time: 10:17:13 AM
User: N/A
Error reading log event record. Handle specified is 691944. Return code from ReadEventLog is 87.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.



Friday, February 26, 2010

Recreate vmdk files for stuffed/corrupted VMs

Below is the command to monitor any processes on the vm

ps -auxwww |grep -i .vmx ( KAD says )

________________sample vmdk file________________


# Disk DescriptorFile

# Extent description
RW 52454274 (GEt this by dividing flat vmdk size value with 512) VMFS "TST-DB01-flat.vmdk"

# The Disk Data Base

ddb.adapterType = "buslogic"
ddb.geometry.sectors = "63"
ddb.geometry.heads = "255" (if flat file bigger then 2 gb)
ddb.geometry.cylinders = "3265" (Get this by dividing FLAT VMDK file size by 8225280
ddb.uuid = "60 00 C2 95 5b 34 57 49-ad 95 7c 96 81 c1 b0 f3"
ddb.toolsVersion = "7302"
ddb.virtualHWVersion = "4"

_______VMDK desc file of a snapshot of the vm_______________

# Disk DescriptorFile
parentCID=e77e6a48 (need to chain it with parent)
parentFileNameHint="PDC-TST-DB01.vmdk" (this should be the desc file not flat file)
# Extent description
RW 52454274 VMFSSPARSE "PDC-TST-DB01-000001-delta.vmdk"

# The Disk Data Base

____________________________END OF FILE______________________________

VMX file of the above machine, Notice it has two disks mentioned below, but i havent put the vmdk for the second disk

config.version = "8"
virtualHW.version = "4"
floppy0.present = "false"
nvram = "PDC-TST-DB01.nvram"
deploymentPlatform = "windows"
virtualHW.productCompatibility = "hosted"
tools.upgrade.policy = "manual"
powerType.powerOff = "default"
powerType.powerOn = "default"
powerType.suspend = "default"
powerType.reset = "default"

displayName = "PDC-TST-DB01"
extendedConfigFile = "PDC-TST-DB01.vmxf"

scsi0.present = "true"
scsi0.sharedBus = "none"
memsize = "1024"
scsi0:0.present = "true"
scsi0:0.fileName = "PDC-TST-DB01-000001.vmdk"
scsi0:0.deviceType = "scsi-hardDisk"
sched.scsi0:0.shares = "normal"
scsi0:1.present = "true"
scsi0:1.fileName = "PDC-TST-DB01_1-000001.vmdk"
scsi0:1.deviceType = "scsi-hardDisk"
sched.scsi0:1.shares = "normal"
ide0:0.present = "true"
ide0:0.fileName = "/dev/scd0"
ide0:0.deviceType = "atapi-cdrom"
ethernet0.present = "true"
ethernet0.wakeOnPcktRcv = "false"
ethernet0.networkName = "PROTECTED"
ethernet0.addressType = "vpx"
ethernet0.generatedAddress = "00:50:56:a5:39:c6"
guestOS = "winnetstandard"
uuid.bios = "50 25 c5 2f 02 02 71 ec-bf 14 72 2e f9 39 df 77"
log.fileName = "vmware.log"
snapshot.action = "keep"
sched.cpu.min = "0"
sched.cpu.units = "mhz"
sched.cpu.shares = "normal"
sched.mem.minsize = "0"
sched.mem.shares = "normal"

scsi0:0.redo = ""
scsi0:1.redo = ""
vmware.tools.requiredversion = "7302"
dMotion.enabled = "FALSE"

tools.syncTime = "FALSE"
uuid.location = "56 4d 37 d2 4d 30 08 fd-a0 18 c9 93 90 9a 28 a4"
migrate.hostlog = "./PDC-TST-DB01-07f9ca4f.hlog"
sched.mem.max = "1024"
sched.swap.derivedName = "/vmfs/volumes/488ad642-565ee789-4ece-001f2963b16a/PDC-TST-DB01/PDC-TST-DB01-07f9ca4f.vswp"
scsi0:0.DMotionParent = ""
scsi0:1.DMotionParent = ""

workingDir = "."

cpuid.1.ecx = "x----0----0--0-R-----------0-0--"
cpuid.1.ecx.amd = "x---------------------------0---"
cpuid.80000001.ecx.amd = "------------------00-00---------"
cpuid.80000001.edx = "----H---------------------------"
hostCPUID.0 = "0000000a756e65476c65746e49656e69"
guestCPUID.0 = "0000000a756e65476c65746e49656e69"
userCPUID.0 = "0000000a756e65476c65746e49656e69"
hostCPUID.1 = "0001067600040800000ce3bdbfebfbff"
guestCPUID.1 = "0001067800010800000822010febbbff"
userCPUID.1 = "0001067600040800000822010febbbff"
hostCPUID.80000001 = "00000000000000000000000120000000"
guestCPUID.80000001 = "00000000000000000000000120000000"
userCPUID.80000001 = "00000000000000000000000120000000"
evcCompatibilityMode = "FALSE"

scsi0:2.present = "false"
scsi0:2.fileName = "PDC-TST-DB01_2.vmdk"
scsi0:2.mode = "independent-persistent"
scsi0:2.deviceType = "scsi-hardDisk"

scsi0:2.redo = ""

Tuesday, February 23, 2010

Websense Policy server won't start

Called websense support after following everything on their support pages.

Had to take out 'WebsenseDb' account from the local admin group, bcos the websense policy database service was starting and stopping with the message that it had nothing to do.
After taking of the account from the local admin group, it remained in started mode.
Policy broker was started next,
Policy Server
Network agent,
user service
and the rest after that

Go figure...
Any explanation on how the about would make a different to the service would be great help.


Monday, February 22, 2010

The SQL Server Agent (MSSQLSERVER) service on local computer started and then stopped

THIS worked for me.

Unable to start SQL Server Agent

We are unable to start SQL Server Agent. It was giving the following error when we were trying to start it from the services console

The SQL Server Agent (MSSQLSERVER) service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.

When we try to change the service account for SQL Server Agent we get the below error,

The process terminated unexpectedly. [0x8007042b]

Tried to start SQL Server Agent from the command prompt using:



Unable to rename C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLAGENT.OUT to C:\ProgramFiles\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLAGENT.1 (reason: The system cannot find the path specified)

2007-08-24 10:10:31 - ! [241] Startup error: Unable to initialize error reporting system (reason: The system cannot find the path specified)

2007-08-24 10:10:31 - ? [098] SQLServerAgent terminated (normally)


Checked the value of key ErrorLogFile in the following registry hive:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\SQLServerAgent

ErrorLogFile key had the below value:

C:\ProgramFiles\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLAGENT.out

However we did not had any such directory present on the machine. Also we did not had any SQLAgent log file.

Changed the value in the ErrorLogFile key to reflect the correct location of the log folder which was on a different drive.

After making the changes we were able to start the SQL Server Agent.

Wednesday, January 20, 2010

VbScript - Find mapped drives on remote PC

ignore the naming convention.... im not too good at naming vars and things..

hope it helps.... did this to help out the helpdesk guys....

Note: pls leave a comment, would like to get feedback.

'This script will give you the mapped drives on a remote machine for the specified user
' It requires the pc name or ip address
' It requires the username of the user whose drive mapping you want to find out on the remote machine
' The script gets the logonsession id and username in the first part of the script and then passes it ot Mappedlogicaldisk to get the drive mappings.
' This script can be refined further to only report on network drive type. however, i cant be stuffed.
'Auth: Rahul & Help from Chris (he wants me to do documentation and indenting... i dont like him

Option explicit

Dim strComputer
Dim strusername
Dim objWMIService
Dim colLogonSession
Dim namevar1, name1, name2, namestr3, nametemp1
Dim logonidvar1, logonid1, logonid2, logonidstr3, logonidtemp1
Dim objSession, colDrives, objDrive

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\cimv2")
' Getting the username and pc name
strcomputer = InputBox("Enter the PC Name")
strusername = InputBox("Enter the username")
'Find out the username and sessionid/logonid
Set colLogonSession = objWMIService.ExecQuery _
("Select * From Win32_LoggedOnUser")
'Working on the string values returned to get the username and logonid
For Each objSession in colLogonSession
namevar1 = objSession.antecedent
logonidvar1 = objSession.dependent
Name1 = (instr(1,Namevar1,"Name=""",1) + 6)
Logonid1 = (instr(1,logonidvar1,"Logonid=""",1) + 9)
name2 = len(namevar1)
Logonid2 = len(Logonidvar1)
nametemp1 = name2 - name1
Logonidtemp1 = Logonid2 - Logonid1
Namestr3 = Mid(namevar1,name1,nametemp1)
logonidstr3 = Mid(logonidvar1,logonid1,logonidtemp1)
'wscript.echo namestr3
'wscript.echo logonidstr3

'Matching username and passing it on to Mappedlogicaldisk to get the network drive mappings.
IF lcase(namestr3) = lcase(strusername) THEN 'it is case sensitive
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\cimv2")
Set colDrives = objWMIService.ExecQuery _
("Select * From Win32_MappedLogicalDisk Where Sessionid = '" & Logonidstr3 & "'")
For Each objDrive in colDrives

Wscript.Echo "Drive letter: " & objDrive.DeviceID
Wscript.Echo "Network path: " & objDrive.ProviderName



Hope it helps.... i did a bit of searching on google before i wrote it, didnt get much luck with googling....

Wednesday, January 6, 2010

Tech Corner

Trying to get my hands onto learning vb scripting. Seems the tech world is pushing powershell.
Lets see how I go.

I will try and share my work experiences and things i learn, so keep visiting.