- Remove From My Forums
-
Question
-
Hi All,
i tried move a folder YYYYmm format using below VBScript, move to destination same folder directory, YYYYyyyyMM. However, command prompt shown me Permission Denied, Error Code: 800A0046.
server Date time format: mm/DD/yyyy, i use VBscript to twist to format DD/MM/yyyy to match folder.
CDATE(currDay+ «/» + currMonth + «/» + CurrYYYY)
'How to use: ' type "archiver D:root source folder" in command line eg: D:Testarchiverarchiver.vbs "D:Testarchiver" DIM strLogFile Const ForAppending = 8 'Wscript.StdOut.WriteBlanklines 100 Set FSO = CreateObject("Scripting.FileSystemObject") strLogFile=WScript.Arguments(0) &"LogARCHIVER_Log_" & Year(Date) & Month(Date) & Day(Date) & ".txt" 'Log folder not exists then create new folder IF NOT FSO.FolderExists(WScript.Arguments(0) &"Log") THEN FSO.CreateFolder WScript.Arguments(0) & "Log" END IF Set objLogFile = FSO.OpenTextFile(strLogFile, ForAppending, True) objLogfile.WriteLine NOW & ">> ------------ ARCHIVER BEGIN ------------------" objLogfile.WriteLine "" objLogfile.WriteLine Now & ">> Root Folder: " & WScript.Arguments(0) objLogfile.WriteLine "" archiver(FSO.GetFolder(WScript.Arguments(0))) objLogfile.WriteLine NOW & ">> ------------ ARCHIVER END ------------------" objLogfile.WriteLine "" objLogFile.Close Sub archiver(Folder) DIM year_ DIM month_ Dim dt dt=now 'output format: yyyymmddHHnn currMonth=Cstr(month(dt)) 'current Month currDay=Cstr(day(dt)) 'current day CurrYYYY=Cstr(year(dt)) 'current Year 'wscript.echo currMonth 'wscript.echo currDay 'wscript.echo CurrYYYY archiveMonth = -6 'Set myLog = objFSO.OpenTextFile(destinationPath, For_Writing, True) For Each Subfolder in Folder.SubFolders IF LEN(subfolder.Name) = 8 AND ISNUMERIC(subfolder.Name) THEN year_ = MID(subfolder.Name,1,4) month_ = MID(subfolder.Name,5,2) objLogfile.WriteLine "Process Checking MM-DD-YY Now......" 'objLogfile.WriteLine FormatDateTime(CDATE("01/" + month + "/" + year),2) 'IF IsDate(CDATE("01/" + month + "/" + year)) AND DateDiff("m", Date, "01/" + month + "/" + year) < archiveMonth THEN IF IsDate(CDATE("01/" + month_ + "/" + year_)) AND DateDiff("m", CDATE(currDay+ "/" + currMonth + "/" + CurrYYYY), "01/" + month_ + "/" + year_) <= archiveMonth THEN objLogfile.WriteLine archiveMonth '-6 objLogfile.WriteLine IsDate(CDATE("01/" + month_ + "/" + year_)) 'True objLogfile.WriteLine NOW & ">> Processing >> " + Subfolder.Name destinationPath = year_ 'WScript.Arguments(0) + " " + year 'Year folder not exists then create new folder IF NOT FSO.FolderExists(destinationPath) THEN FSO.CreateFolder destinationPath END IF IF FSO.FolderExists(destinationPath) THEN destinationPath = destinationPath + "" + year_ + month_ IF FSO.FolderExists(destinationPath) THEN objLogfile.WriteLine NOW & ">> Moving folder " + Subfolder.Name + " to destination: " + destinationPath Subfolder.Move destinationPath + "" + Subfolder.Name ELSE 'Year + Month folder not exists then create new folder FSO.CreateFolder destinationPath IF FSO.FolderExists(destinationPath) THEN objLogfile.WriteLine NOW & ">> Moving folder " + Subfolder.Name + " to destination: " + destinationPath Subfolder.Move destinationPath + "" + Subfolder.Name ELSE objLogfile.WriteLine NOW & ">> ** ERROR: Unable to create folder: " + destinationPath END IF END IF ELSE objLogfile.WriteLine NOW & ">> ** ERROR: Unable to create folder: " + destinationPath END IF 'Wscript.StdOut.WriteBlanklines 1 'objLogfile.WriteLine "" END IF END IF Next End Sub
Error Message
Script: D:….Archivedarchiver.vbs
Line: 71
Char: 7
Error Code: Permission Denied
Code: 800A0046
Source Code: Microsoft VBScript runtime error
-
Moved by
Wednesday, January 2, 2019 3:18 PM
This is not «fix/debug/rewrite my script for me» forum
-
Moved by
- Remove From My Forums
-
Question
-
Hi All,
i tried move a folder YYYYmm format using below VBScript, move to destination same folder directory, YYYYyyyyMM. However, command prompt shown me Permission Denied, Error Code: 800A0046.
server Date time format: mm/DD/yyyy, i use VBscript to twist to format DD/MM/yyyy to match folder.
CDATE(currDay+ «/» + currMonth + «/» + CurrYYYY)
'How to use: ' type "archiver D:root source folder" in command line eg: D:Testarchiverarchiver.vbs "D:Testarchiver" DIM strLogFile Const ForAppending = 8 'Wscript.StdOut.WriteBlanklines 100 Set FSO = CreateObject("Scripting.FileSystemObject") strLogFile=WScript.Arguments(0) &"LogARCHIVER_Log_" & Year(Date) & Month(Date) & Day(Date) & ".txt" 'Log folder not exists then create new folder IF NOT FSO.FolderExists(WScript.Arguments(0) &"Log") THEN FSO.CreateFolder WScript.Arguments(0) & "Log" END IF Set objLogFile = FSO.OpenTextFile(strLogFile, ForAppending, True) objLogfile.WriteLine NOW & ">> ------------ ARCHIVER BEGIN ------------------" objLogfile.WriteLine "" objLogfile.WriteLine Now & ">> Root Folder: " & WScript.Arguments(0) objLogfile.WriteLine "" archiver(FSO.GetFolder(WScript.Arguments(0))) objLogfile.WriteLine NOW & ">> ------------ ARCHIVER END ------------------" objLogfile.WriteLine "" objLogFile.Close Sub archiver(Folder) DIM year_ DIM month_ Dim dt dt=now 'output format: yyyymmddHHnn currMonth=Cstr(month(dt)) 'current Month currDay=Cstr(day(dt)) 'current day CurrYYYY=Cstr(year(dt)) 'current Year 'wscript.echo currMonth 'wscript.echo currDay 'wscript.echo CurrYYYY archiveMonth = -6 'Set myLog = objFSO.OpenTextFile(destinationPath, For_Writing, True) For Each Subfolder in Folder.SubFolders IF LEN(subfolder.Name) = 8 AND ISNUMERIC(subfolder.Name) THEN year_ = MID(subfolder.Name,1,4) month_ = MID(subfolder.Name,5,2) objLogfile.WriteLine "Process Checking MM-DD-YY Now......" 'objLogfile.WriteLine FormatDateTime(CDATE("01/" + month + "/" + year),2) 'IF IsDate(CDATE("01/" + month + "/" + year)) AND DateDiff("m", Date, "01/" + month + "/" + year) < archiveMonth THEN IF IsDate(CDATE("01/" + month_ + "/" + year_)) AND DateDiff("m", CDATE(currDay+ "/" + currMonth + "/" + CurrYYYY), "01/" + month_ + "/" + year_) <= archiveMonth THEN objLogfile.WriteLine archiveMonth '-6 objLogfile.WriteLine IsDate(CDATE("01/" + month_ + "/" + year_)) 'True objLogfile.WriteLine NOW & ">> Processing >> " + Subfolder.Name destinationPath = year_ 'WScript.Arguments(0) + " " + year 'Year folder not exists then create new folder IF NOT FSO.FolderExists(destinationPath) THEN FSO.CreateFolder destinationPath END IF IF FSO.FolderExists(destinationPath) THEN destinationPath = destinationPath + "" + year_ + month_ IF FSO.FolderExists(destinationPath) THEN objLogfile.WriteLine NOW & ">> Moving folder " + Subfolder.Name + " to destination: " + destinationPath Subfolder.Move destinationPath + "" + Subfolder.Name ELSE 'Year + Month folder not exists then create new folder FSO.CreateFolder destinationPath IF FSO.FolderExists(destinationPath) THEN objLogfile.WriteLine NOW & ">> Moving folder " + Subfolder.Name + " to destination: " + destinationPath Subfolder.Move destinationPath + "" + Subfolder.Name ELSE objLogfile.WriteLine NOW & ">> ** ERROR: Unable to create folder: " + destinationPath END IF END IF ELSE objLogfile.WriteLine NOW & ">> ** ERROR: Unable to create folder: " + destinationPath END IF 'Wscript.StdOut.WriteBlanklines 1 'objLogfile.WriteLine "" END IF END IF Next End Sub
Error Message
Script: D:….Archivedarchiver.vbs
Line: 71
Char: 7
Error Code: Permission Denied
Code: 800A0046
Source Code: Microsoft VBScript runtime error
-
Moved by
Wednesday, January 2, 2019 3:18 PM
This is not «fix/debug/rewrite my script for me» forum
-
Moved by
- Remove From My Forums
-
Question
-
I’m so close to get my script to work with a user, but I need your help.
I have a Terminal Server 2003 with policy restrictions. My users can’t even see how much megabytes they have in use. So I created the following script. It runs perfectly with an administrator account:—
Dim oFS, oFolder
Dim total
Dim message
set oFS = WScript.CreateObject(«Scripting.FileSystemObject»)
set oFolder1 = oFS.GetFolder(«\servershare$»)
set oFolder2 = oFS.GetFolder(«\servershare1$»)
set oFolder3 = oFS.GetFolder(«\servershare2$»)
Wscript.Sleep 300
total = oFolder1.Size + oFolder2.Size + oFolder3.Size
message=MsgBox («Size: » & vbTab & oFolder1.Size /10241024 & «MB» & vbTab & » Path: » & vbTab & oFolder1.Path & Chr(10) _
& «Size: » & vbTab & oFolder2.Size /10241024 & «MB» & vbTab & » Path: » & vbTab & oFolder2.Path & Chr(10) _
& «Size: » & vbTab & oFolder3.Size /10241024 & «MB» & vbTab & » Path: » & vbTab & oFolder3.Path & Chr(10) _
& «Total: » & vbTab & total /10241024 & «MB»,64,»megabytes in use»)
—The problem I’m facing is that I can’t distribute it to my users because when this script runs as an user I receive this error:
Windows Script Host
Script: pathandname.vbs
Line: 9
Char: 1
Error: Permission denied
Code: 800A0046
Source: Microsoft VBScript runtime errorI’ve checked the users permission on the servershare’s and they have Full Control.
Also on the ACL on the script the user has Full Control.What else can I check?
Is there a setting in some GPO that denies users to run a .vbs?Please let me know when you need more information to solve this.
Cheers,
Yuri
Answers
-
Are you sure the users have permissions to ALL files and directories on the shares?
If there is as much as one file or folder to which the user hasn’t got at least «list contents» permission the script will fail with the above message.If you check the properties of the root of the share from explorer, first as an administrator and then as a user. Does it show the same amount of files/folders and the same size?
A difference here would indicate that the user doesn’t have permissions to everything.-
Marked as answer by
Tuesday, September 1, 2009 9:14 AM
-
Marked as answer by
kipriot |
|
Статус: Новичок Группы: Участники Поблагодарили: 1 раз в 1 постах |
Такая проблема при формировании сертификата — Система Windows 8.1 x64, КриптоПро CSP 3.9.8227 Пользователь kipriot прикрепил следующие файлы:
У Вас нет прав для просмотра или загрузки вложений. Попробуйте зарегистрироваться. |
|
|
kipriot |
|
Статус: Новичок Группы: Участники Поблагодарили: 1 раз в 1 постах |
В режима отладки проверил, показывает: А поддержка всё молчит…… |
|
|
kipriot |
|
Статус: Новичок Группы: Участники Поблагодарили: 1 раз в 1 постах |
Путём манипуляций с настройками IE 11 (разрешением всего и вся в настройках безопасности), процесс пошёл, Крипто про подрубается, появляется «датчик случайных чисел» и….выскакивает: Кажется начинаю понимать где собака зарыта |
|
|
kipriot |
|
Статус: Новичок Группы: Участники Поблагодарили: 1 раз в 1 постах |
В общем победил. Моя система win 8.1 x64, браузер IE 11, КриптоПро CSP 3.9. Итак. PS. По всей видимости сей offreq был написан в незапамятные времена для windows 95 |
|
|
|
winnie-the-pooh
оставлено 23.08.2016(UTC) |
Пользователи, просматривающие эту тему |
Guest |
Быстрый переход
Вы не можете создавать новые темы в этом форуме.
Вы не можете отвечать в этом форуме.
Вы не можете удалять Ваши сообщения в этом форуме.
Вы не можете редактировать Ваши сообщения в этом форуме.
Вы не можете создавать опросы в этом форуме.
Вы не можете голосовать в этом форуме.
I have a script that I put together for my users a few years ago for them to log onto to the company drive shares after they had logged into the VPN. The script has worked well over the years with a few tweaks needed here and there due to IE version upgrades. As of today I can no longer get the script to function properly the Error is:
Line: 93
Char: 5
Error: Permission denied: 'objIE.Document.parentWindow.screen'
Code: 800A0046
Source: Microsoft VBScript runtime error
I’m not sure what has changed but after doing multiple searches on the error codes and other items I figured I’d post it here and see if any of you can help me with this problem.
dim WshNetwork
Dim arrFileLines()
'On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("Drive Shares.txt", 1)
If Not err.number = 0 then
WScript.Echo "Drive Shares.txt was not found. Please ensure that it is in the same directory as this script file"
WScript.Quit
End If
NumElements = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(NumElements)
arrFileLines(NumElements) = objFile.ReadLine
NumElements = NumElements + 1
Loop
objFile.Close
strPw = GetPassword()
If strPw = "" Then
wScript.Quit
End If
SplitPasswd = Split(StrPW,"*",2)
username = "DEFAULT" & SplitPasswd(0)
password = SplitPasswd(1)
Set WshNetwork = Wscript.CreateObject("WScript.Network")
For Count = 0 to (NumElements - 1)
SplitDriveInfo = Split(arrFileLines(Count)," ",2)
DriveLetter = SplitDriveInfo(0)
Share = SplitDriveInfo(1)
ExitCode = WshNetwork.MapNetworkDrive(DriveLetter, Share, false, username, password)
ErrorHandler(err.number)
Next
Sub ErrorHandler(ErrorNumber)
Select Case ErrorNumber
Case 0
'OK
Exit Sub
Case -2147024811
'Already Mapped Continue
Exit Sub
Case -2147024843
'No Connection
WScript.Echo "No connection found. Confirm you have an internet connection and that you have the VPN connected."
WScript.Quit
Case -2147024829
'Share not available
WScript.Echo "The drive share you are trying to connect to does not exist on this server."
WScript.Quit
Case -2147023570
'Invalid username or password
WScript.Echo "Invalid username or password. Please try again."
WScript.quit
Case Else
WScript.Echo "Unknown error: " & CStr(ErrorNumber)
WScript.Quit
End Select
End Sub
Function GetPassword()
Dim objIE
Set objIE = CreateObject( "InternetExplorer.Application" )
objIE.Navigate "about:blank"
objIE.Document.Title = "Login Credentials"
objIE.ToolBar = False
objIE.Resizable = False
objIE.StatusBar = False
objIE.Width = 320
objIE.Height = 320
With objIE.document.parentWindow.screen
objIE.Left = (.availwidth - objIE.Width ) 2
objIE.Top = (.availheight - objIE.Height) 2
End With
objIE.Document.Body.InnerHTML = "<DIV align=""center""><P>Please enter your credentials</P>" & vbCrLf _
& "<DIV align=""center""><P>Username</P>" & vbCrLf _
& "<P><INPUT TYPE=""Username"" SIZE=""20"" " _
& "ID=""UserName""></P>" & vbCrLf _
& "<DIV align=""center""><P>Password</P>" & vbCrLf _
& "<P><INPUT TYPE=""password"" SIZE=""20"" " _
& "ID=""Password""></P>" & vbCrLf _
& "<P><INPUT TYPE=""hidden"" ID=""OK"" " _
& "NAME=""OK"" VALUE=""0"">" _
& "<INPUT TYPE=""submit"" VALUE="" OK "" " _
& "OnClick=""VBScript:OK.Value=1""></P></DIV>"
objIE.Visible = True
Do While objIE.Document.All.OK.Value = 0
WScript.Sleep 200
Loop
GetPassword = objIE.Document.All.UserName.Value & "*" & objIE.Document.All.Password.Value
objIE.Quit
Set objIE = Nothing
End Function
Any help with this would be greatly appreciated.
I have a script that I put together for my users a few years ago for them to log onto to the company drive shares after they had logged into the VPN. The script has worked well over the years with a few tweaks needed here and there due to IE version upgrades. As of today I can no longer get the script to function properly the Error is:
Line: 93
Char: 5
Error: Permission denied: 'objIE.Document.parentWindow.screen'
Code: 800A0046
Source: Microsoft VBScript runtime error
I’m not sure what has changed but after doing multiple searches on the error codes and other items I figured I’d post it here and see if any of you can help me with this problem.
dim WshNetwork
Dim arrFileLines()
'On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("Drive Shares.txt", 1)
If Not err.number = 0 then
WScript.Echo "Drive Shares.txt was not found. Please ensure that it is in the same directory as this script file"
WScript.Quit
End If
NumElements = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(NumElements)
arrFileLines(NumElements) = objFile.ReadLine
NumElements = NumElements + 1
Loop
objFile.Close
strPw = GetPassword()
If strPw = "" Then
wScript.Quit
End If
SplitPasswd = Split(StrPW,"*",2)
username = "DEFAULT" & SplitPasswd(0)
password = SplitPasswd(1)
Set WshNetwork = Wscript.CreateObject("WScript.Network")
For Count = 0 to (NumElements - 1)
SplitDriveInfo = Split(arrFileLines(Count)," ",2)
DriveLetter = SplitDriveInfo(0)
Share = SplitDriveInfo(1)
ExitCode = WshNetwork.MapNetworkDrive(DriveLetter, Share, false, username, password)
ErrorHandler(err.number)
Next
Sub ErrorHandler(ErrorNumber)
Select Case ErrorNumber
Case 0
'OK
Exit Sub
Case -2147024811
'Already Mapped Continue
Exit Sub
Case -2147024843
'No Connection
WScript.Echo "No connection found. Confirm you have an internet connection and that you have the VPN connected."
WScript.Quit
Case -2147024829
'Share not available
WScript.Echo "The drive share you are trying to connect to does not exist on this server."
WScript.Quit
Case -2147023570
'Invalid username or password
WScript.Echo "Invalid username or password. Please try again."
WScript.quit
Case Else
WScript.Echo "Unknown error: " & CStr(ErrorNumber)
WScript.Quit
End Select
End Sub
Function GetPassword()
Dim objIE
Set objIE = CreateObject( "InternetExplorer.Application" )
objIE.Navigate "about:blank"
objIE.Document.Title = "Login Credentials"
objIE.ToolBar = False
objIE.Resizable = False
objIE.StatusBar = False
objIE.Width = 320
objIE.Height = 320
With objIE.document.parentWindow.screen
objIE.Left = (.availwidth - objIE.Width ) 2
objIE.Top = (.availheight - objIE.Height) 2
End With
objIE.Document.Body.InnerHTML = "<DIV align=""center""><P>Please enter your credentials</P>" & vbCrLf _
& "<DIV align=""center""><P>Username</P>" & vbCrLf _
& "<P><INPUT TYPE=""Username"" SIZE=""20"" " _
& "ID=""UserName""></P>" & vbCrLf _
& "<DIV align=""center""><P>Password</P>" & vbCrLf _
& "<P><INPUT TYPE=""password"" SIZE=""20"" " _
& "ID=""Password""></P>" & vbCrLf _
& "<P><INPUT TYPE=""hidden"" ID=""OK"" " _
& "NAME=""OK"" VALUE=""0"">" _
& "<INPUT TYPE=""submit"" VALUE="" OK "" " _
& "OnClick=""VBScript:OK.Value=1""></P></DIV>"
objIE.Visible = True
Do While objIE.Document.All.OK.Value = 0
WScript.Sleep 200
Loop
GetPassword = objIE.Document.All.UserName.Value & "*" & objIE.Document.All.Password.Value
objIE.Quit
Set objIE = Nothing
End Function
Any help with this would be greatly appreciated.