Re: VBScript Windows 7 / Windows Vista
- From: Anthony Humphreys <ahumphreys1980@xxxxxxxxx>
- Date: Thu, 23 Jul 2009 02:18:02 -0700 (PDT)
Thanks for the tip,
I will try the Bat file now,
in my VBScript the files where indented for readability, they just
didn't come across very well. (either that or I had word wrapping
turned on when I copied them)
re: The spelling mistake, I checked the source and this spelling
mistake did not exist.
I ended up reducing the script to just the following
'==========================================================================
Dim objFSO
Dim objShell
Dim objSourceFolder
Dim intSourceFileCount
Dim intFileCount
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
objITXLogoDirectory = objShell.ExpandEnvironmentStrings("%WinDir%") &
"\system32\oobe\info\backgrounds"
objITXLogoSource = objShell.ExpandEnvironmentStrings("%LogonServer%")
& "\netlogon\ITX_Backgrounds"
Set objSourceFolder = objFSO.GetFolder(objITXLogoSource)
For Each objFile In objSourceFolder.Files
intSourceFileCount = intSourceFileCount + 1
Next
With objFSO
If .FolderExists(objITXLogoDirectory) = False Then
'Folder doesn't exist, So Create Folder, then Copy Images
'Need to check each level of the directory Structure
If .FolderExists(objShell.ExpandEnvironmentStrings("%Windir%") &
"\system32\oobe") = False Then objFSO.CreateFolder
(objShell.ExpandEnvironmentStrings("%Windir%") & "\system32\oobe\")
If .FolderExists(objShell.ExpandEnvironmentStrings("%Windir%") &
"\system32\oobe\info") = False Then objFSO.CreateFolder
(objShell.ExpandEnvironmentStrings("%Windir%") & "\system32\oobe\info
\")
If .FolderExists(objShell.ExpandEnvironmentStrings("%Windir%") &
"\system32\oobe\info\backgrounds") = False Then objFSO.CreateFolder
(objShell.ExpandEnvironmentStrings("%Windir%") & "\system32\oobe\info
\backgrounds\")
Set objSourceFolder = objFSO.GetFolder(objITXLogoSource)
End If
End With
strCommandtoRun = "xcopy " & objSourceFolder & "\*.* " &
objITXLogoDirectory & "\"
objShell.Run strCommandToRun
'Wscript.echo strCommandToRun
With objShell
.RegWrite "HKLM\Software\Microsoft\Windows\CurrentVersion
\Authentication\LogonUI\Background", 1, "REG_DWORD"
End With
'Set the correct Registry Value if it hasn't been set by the Login
Script yet
'HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI
\Background
'==========================================================================
and noticed that neither the folders where created, nor where the
registry entry made.
This was set as a startup script in Windows 2008 on a Windows 7
desktop.
- So if rules of GPO are true, the script should have access to HKLM
to make the registry modifications.
- I confirmed that the Domain Computers have read access to the
netlogon directory
- No Files are created in C:\Windows\System32\oobe\info nor in C:
\Windows\SysWOW64\oobe\ as I thought maybe WOW might be causing the
problem.
- Because it is a startup script, It is difficult for me to put any
debugging code in there (at least I think it is)
I did make some modifications to your BAT file, the contents are
below.
#
==========================================================================
@echo off
set objITXLogoDirectory=%WinDir%\system32\oobe\info\backgrounds\
set objITXLogoSource=%LogonServer%\NetLogon\ITX_Backgrounds\
If not exist %Windir%\system32\oobe\info\backgrounds md %Windir%
\system32\oobe\info\backgrounds
echo xcopy /d /c "%objITXLogoSource%\*.jpg" "%objITXLogoDirectory%" >>
c:\test.txt
xcopy /d /c "%objITXLogoSource%*.jpg" "%objITXLogoDirectory%" 1>>c:
\test.txt 2>>&1
echo > "%Temp%\temp.reg" REGEDIT4
echo >>"%Temp%\temp.reg" [HKey_Local_Machine\Software\Microsoft\Windows
\CurrentVersion\Authentication\LogonUI]
echo >>"%Temp%\temp.reg" "Background"=dword:1
regedit /s "%Temp%\temp.reg"
del "%temp%\temp.reg" /y
#
==========================================================================
The bat file seemed to work fine, however, as This is just a pre-
cursor to some of the things I plan to do via Login Script, I would
like to know why the VBScript failed.
Time to break it down into managable chunks I think :)
- What's the best way to output a Startup Script (VBScript) to a text
file?
.
- Follow-Ups:
- Re: VBScript Windows 7 / Windows Vista
- From: Pegasus [MVP]
- Re: VBScript Windows 7 / Windows Vista
- References:
- VBScript Windows 7 / Windows Vista
- From: Anthony Humphreys
- Re: VBScript Windows 7 / Windows Vista
- From: Pegasus [MVP]
- Re: VBScript Windows 7 / Windows Vista
- From: Anthony Humphreys
- Re: VBScript Windows 7 / Windows Vista
- From: Pegasus [MVP]
- VBScript Windows 7 / Windows Vista
- Prev by Date: Re: some questions about 'username' and 'WSHshell.run'
- Next by Date: Re: VBScript Windows 7 / Windows Vista
- Previous by thread: Re: VBScript Windows 7 / Windows Vista
- Next by thread: Re: VBScript Windows 7 / Windows Vista
- Index(es):
Relevant Pages
|