Jaký je nainstalovaný Service Pack
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.ServicePackMajorVersion _
& "." & objOperatingSystem.ServicePackMinorVersion
Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
Wscript.Echo objOperatingSystem.ServicePackMajorVersion _
& "." & objOperatingSystem.ServicePackMinorVersion
Next
___________________________________________________________________
Přidej doménového uživatele do lokálních administrátorů
strComputer = "atl-ws-01"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer")
objGroup.Add(objUser.ADsPath)
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer")
objGroup.Add(objUser.ADsPath)
_____________________________________________________________________
Ověř, zda-li je user lokalní administrátor
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
strUser = objNetwork.UserName
strComputer = objNetwork.ComputerName
strUser = objNetwork.UserName
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser in objGroup.Members
If objUser.Name = strUser Then
Wscript.Echo strUser & " is a local administrator."
End If
Next
For Each objUser in objGroup.Members
If objUser.Name = strUser Then
Wscript.Echo strUser & " is a local administrator."
End If
Next
_________________________________________________________________________
Alert .pst Size
sComputer = "."
Set oWMIService = GetObject("winmgmts:\\" & sComputer & "\root\cimv2")
Set colItems = oWMIService.ExecQuery("Select * From Win32_ComputerSystem")
Set colItems = oWMIService.ExecQuery("Select * From Win32_ComputerSystem")
For Each oItem in colItems
aUsrProfName = Split(oItem.UserName,"\")
sUsrProfName = aUsrProfName(1)
Next
aUsrProfName = Split(oItem.UserName,"\")
sUsrProfName = aUsrProfName(1)
Next
Set FSO=CreateObject("Scripting.FileSystemObject")
If FSO.driveexists("c:") = true then
sMyDocsFolder = "c:\Documents and Settings\" & sUsrProfName & "\Local Settings\Data aplikací\Microsoft\Outlook"
If FSO.folderexists(sMyDocsFolder) Then
Set oMyDocsFolder = FSO.GetFolder(sMyDocsFolder)
For Each oFile in oMyDocsFolder.Files
If LCase(Right(oFile.Name, 4)) = ".pst" Then
sFileName = oFile.Name
bFileFound = true
Exit For
End If
Next
If FSO.folderexists(sMyDocsFolder) Then
Set oMyDocsFolder = FSO.GetFolder(sMyDocsFolder)
For Each oFile in oMyDocsFolder.Files
If LCase(Right(oFile.Name, 4)) = ".pst" Then
sFileName = oFile.Name
bFileFound = true
Exit For
End If
Next
If bFileFound Then
alarmSize = 2
alarmSize = 2
Set File = FSO.GetFile(sMyDocsFolder & "\" & oFile.Name)
sSize = File.Size\1024
If sSize > alarmSize Then
Set objshell = CreateObject("Wscript.Shell")
iMessage = Msgbox("Varování: Váš mailbox " & _
"se přiblížil maximální hranici " & alarmSize & " Mb. " & _
vbNewLine & vbNewLine & "Je potřeba promazat nepotřebné e-maily. " & _
"Případně se obraťte na IT oddělení.")
"se přiblížil maximální hranici " & alarmSize & " Mb. " & _
vbNewLine & vbNewLine & "Je potřeba promazat nepotřebné e-maily. " & _
"Případně se obraťte na IT oddělení.")
End If
End If
End If
End If
End If
End If
End If