what is the difference between these
"objnetwork" and "wshnetwork"
many thanks
what is the difference between these
"objnetwork" and "wshnetwork"
many thanks

I guess you are trying to map a network drive?
Its been a long time since I did much programming but aren't these just commonly used variable names used when mapping network drives?
Essentially theres no difference as they could be called anything.
So if you are trying to map a network drive you would something like:
Option Explicit
Dim objWshNetwork (declare var - could be anything)
Set objWshNetwork = CreateObject("WScript.Network") (assign var)
objWshNetwork.MapNetworkDrive("x:","\\Server\Share ")
its for printer scripts. I have seen tehse two variations and wondered what is the difference
As per above they are just variables - you can call it network or mynetwork or whatever you want as long as when you create the object you use the same name for examplewhat is the difference between these
"objnetwork" and "wshnetwork"
many thanks
As you can see I have declared Network using the Dim statement, I have then used the Set statement to Set the Network variable so it is equal to the network object which you have to create using CreateObject("WScript.Network")Code:Dim Network Set Network = CreateObject("WScript.Network") Network.MapNetworkDrive("x:",\\Server\Share )
Then when you want to use the Network variable to do something you put Network.Property
Property could be UserName, MapNetworkDrive or whatever property you want to use that is related to the network object as long as its used in the correct way
One of the things that can be really confusing in programming in VBScript is the use of variable names; people generally have their own way of naming things but the growth of the internet has meant that most people copy bits of code and edit it - this seems to have lead to certain variables gaining dominance so it looks as if the name matters.
In a statement like:
the bit that matters is on the right - you're working with that specific object but you can call it oNet, Network, objNetwork, tom, dick or harry but once you've chosen the name you need to stick with that name while you work with it.Code:set oNet = CreateObject("wscript.network")
In the example above, oFile1 and oFile2 are both file objects; they both refer to the same file on disc but they're not the same thing - when I read a line from oFile1 it doesn't do anything to oFile2. When I close oFile1 it doesn't affect oFile2 etc.Code:set oFSO=createobject("scripting.filesystemobject") set oFile1=ofso.opentextfile("c:\temp\data.txt") set oFile2=ofso.opentextfile("c:\temp\data.txt") sLine1=oFile1.readline wscript.echo sLine oFile1.close sLine2=oFile2.readline oFile2.close

Hello,
I am kind of new to programming but it looks interesting as i want to make an script for my WMI filter.
i want to use a WMI filter to look into the department field and if there is a user with department field set to sales than he should get"policy 1"
and if the user is in production than the user should get "policy 2"
but i just can not figure out where i can get the object from department field
can some one help me on the way?
There are currently 1 users browsing this thread. (0 members and 1 guests)