Hej alle "nørder" ;)
Først og fremmest vil jeg undskylde, hvis jeg allerede her i min første post, får brudt nogle regler.
Jeg står og mangler et script i firmaet, der kan hjælpe mig med at se folder size på diverse terminal servere. Vi har en masse bruger profiler, der max må være 30mb. Derfor ønsker jeg et script der kan give en warning, når den er ved at nå limit. Følgende scripts er fundet på nettet og jeg vil høre om nogle af jer, kan gennemskue hvad jeg mangler at tilføje, før jeg får output til OpenOffice Calc.
I den sidste del af koden er der en kode der gør brug af smtp også har jeg fundet en anden kode, der skulle gøre det muligt at få output til OpenOffice Calc. Hvad tror I, ville fungere bedst?
Jeg må nok også hellere gøre det klart, at jeg bestemt ikke har styr på at kode vbs! ;)
På forhånd tak.
-----------------------------------------------
------------------
Dim oFSObject
Dim oFSFolder
Dim sMsg
Dim sDrive
Dim sFolderPath
sFolderPath = "\\server\share"
Set oFSObject = CreateObject("Scripting.FileSystemObject") '**** Create the instance of the file system object
If oFSObject.FolderExists(sFolderPath) Then '**** If the folder exists
Set oFSFolder = oFSObject.GetFolder(sFolderPath) '**** Get the folder object
If Not oFSFolder Is Nothing Then '**** If we successfully got the folder
'10000 = 10MB
'20000 = 20MB
'25000 = 25MB
If oFSFolder.Size > 25000 Then
sMsg = "This email has been sent by VBScript." & vbcrlf _
& vbcrlf & "The folder " & sFolderPath & " is greater than 25MB." & vbcrlf _
& vbcrlf & "An archive should be created within the next week to avoid exceeding the 30MB tape limit."
End If
Else
'**** Something went wrong trying to get the folder, perhaps permissions aren't set properly, check the rights
sMsg = "The folder " & sFolderPath & " could not be retrieved. Please make sure you have the appropriate network permissions and that the folder is properly shared."
End If
Else
'**** The folder doesn't exist, it's not shared or there is network communication trouble
sMsg = "The folder " & sFolderPath & " could not be retrieved. Please check the folder's path (" & sFolderPath & ") and the local area network connection."
End if
If Len(sMsg) > 0 Then
'MsgBox sMsg
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Size Warning (25MB)"
objMessage.Sender = "myserver @mydomain.com"
objMessage.From = "myserver @mydomain.com"
objMessage.To = "
[email protected]"
objMessage.TextBody = sMsg
-----------------------------------------------
---
--------------------------------------------------
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com[...] = 2
'==This command will stop smptp authentication'
'==ObjMessage.Configuration.Fields.Item _
'==("
http://schemas.microsoft.com[...] = 0
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com[...] = "mail.mydomain.com"
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("
http://schemas.microsoft.com[...] = 25
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send
End If
Set oFSFolder = Nothing
Set oFSObject = Nothing
--------------------------------------------
-------------------------------------------
set objServiceManager = WScript.CreateObject("com.sun.star.ServiceManager-
")
set objCoreReflection= objServiceManager.createInstance("com.sun.star.re-
flection.CoreReflection")
set oDesk= objServiceManager.createInstance("com.sun.star.fr-
ame.Desktop")
dim args()
set oDoc = oDesk.loadComponentFromURL("file:///C:/test123.od-
t","_blank",0,args)
set oGraph = oDoc.createInstance("com.sun.star.text.TextGraphi-
cObject")
-------------------------------------
----------
-------------------------------------------
---
--