This is how you would stream an ogg URL.
Just add this to the BODY portion of your website
To get this
Lab Core | The Lab of MrNetTek
A blog about IT, technical solutions, and code.
Add this to the HEAD
to the BODY
on the ELEMENT you want to make a sound
Or you can put your mouse over to hear the sound.
In Windows 7, some of your personal folders and files may have a padlock overlay icon on them and you might be wondering what it indicates and how to get rid of it. The Lock icon indicates that the file or folder is shared with nobody but you, and that your account alone has the permission to access it (besides the SYSTEM and admin accounts). This icon is shown only when some item that was shared previously with other users was made private. It is easy to remove this icon if you find it unwanted.
The command for your scripts
reg.exe delete “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\SharingPrivate” /force
So, the point of this snippet of code is to search through the registry or specified registry key looking for a specific string.
For me, I was looking for the creation of a temporary profile. I would later use this returned value to remove the temporary profile – allowing the normal user profile to load.
The script
@echo off
set RETURN=false
set POLICY=.bak
FOR /F “tokens=*” %%A IN (‘REG.EXE QUERY “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList”‘) DO (
Echo %%A | findstr /C:”%POLICY%”>nul && (
set RETURN=true
)
)
echo %RETURN%
pause
Other cool stuff you can do with reg query
REG QUERY KeyName [/v [ValueName] | /ve] [/s]
[/f Data [/k] [/d] [/c] [/e]] [/t Type] [/z] [/se Separator]
KeyName [\\Machine\]FullKey
Machine – Name of remote machine, omitting defaults to the
current machine. Only HKLM and HKU are available on
remote machines
FullKey – in the form of ROOTKEY\SubKey name
ROOTKEY – [ HKLM | HKCU | HKCR | HKU | HKCC ]
SubKey – The full name of a registry key under the
selected ROOTKEY
/v Queries for a specific registry key values.
If omitted, all values for the key are queried.
Argument to this switch can be optional only when specified
along with /f switch. This specifies to search in valuenames only.
/ve Queries for the default value or empty value name (Default).
/s Queries all subkeys and values recursively (like dir /s).
/se Specifies the separator (length of 1 character only) in
data string for REG_MULTI_SZ. Defaults to “\0” as the separator.
/f Specifies the data or pattern to search for.
Use double quotes if a string contains spaces. Default is “*”.
/k Specifies to search in key names only.
/d Specifies the search in data only.
/c Specifies that the search is case sensitive.
The default search is case insensitive.
/e Specifies to return only exact matches.
By default all the matches are returned.
/t Specifies registry value data type.
Valid types are:
REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ,
REG_DWORD, REG_QWORD, REG_BINARY, REG_NONE
Defaults to all types.
/z Verbose: Shows the numeric equivalent for the type of the valuename.
Examples:
REG QUERY HKLM\Software\Microsoft\ResKit /v Version
Displays the value of the registry value Version
REG QUERY \\ABC\HKLM\Software\Microsoft\ResKit\Nt\Setup /s
Displays all subkeys and values under the registry key Setup
on remote machine ABC
REG QUERY HKLM\Software\Microsoft\ResKit\Nt\Setup /se #
Displays all the subkeys and values with “#” as the seperator
for all valuenames whose type is REG_MULTI_SZ.
REG QUERY HKLM /f SYSTEM /t REG_SZ /c /e
Displays Key, Value and Data with case sensitive and exact
occurrences of “SYSTEM” under HKLM root for the data type REG_SZ
REG QUERY HKCU /f 0F /d /t REG_BINARY
Displays Key, Value and Data for the occurrences of “0F” in data
under HKCU root for the data type REG_BINARY
REG QUERY HKLM\SOFTWARE /ve
Displays Value and Data for the empty value (Default)
under HKLM\SOFTWARE
on error resume next set ObjShell = CreateObject("WScript.Shell") strComputerName = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%computername%") Dim arrFileLines() i = 0 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("account_info_here.txt", 1) Do Until objFile.AtEndOfStream Redim Preserve arrFileLines(i) arrFileLines(i) = objFile.ReadLine i = i + 1 Loop objFile.Close 'assign array item to variable fname = arrFileLines(0) lname = arrFileLines(1) pword = arrFileLines(2) 'trim white space from beginning and end fname = trim(fname) lname = trim(lname) pword = trim(pword) strleft = left(fname,1) comb = strleft & lname
‘The magic piece: code snippet
‘Runs an empty command (cmd.exe /c) using the user’s known username and password.
‘This forces Windows to create that user’s profile.
ObjShell.Run “C:\setup\scripts\cpau.exe -u ” & strComputerName & “\” & comb & ” -p ” & chr(34) & pword & chr(34) & ” -ex “”cmd.exe /c”” -lwp -wait”,0,true
WScript.Quit(0)
This is how to script folder redirection—to be used in Windows 7 post-setup (right after imaging a machine)
This will pull account information from a text file, generate a user profile based upon that information, and then redirect that user profile – even before the user actually logs in for the first time.
@echo off
setlocal enableextensions enabledelayedexpansion
color 0a
set FName=
set LName=
set COMB=
set PWord=
set count=0
set count=1
rem policy – used to guarantee the redirect works properly – the user_account.txt is required
if not exist user_account.txt exit /b 0
rem pulls first name from account file
for /f “delims=” %%b in (user_account.txt) do (
if !count!==1 set FNAME=%%b
Set FName=!FNAME:~0,1!
set /a count+=1
)
rem pulls last name from account file
set count=1
for /f “delims=” %%c in (user_account.txt) do (
if !count!==2 set LNAME=%%c
set /a count+=1
)
rem sets username based upon first initial and lastname from account file
set COMB=!FNAME!!LNAME!
rem sets password from account file
set count=1
for /f “delims=” %%d in (user_account.txt) do (
if !count!==3 set PWord=%%d
set /a count+=1
)
rem generates user profile to be used to set folder redirection
C:\setup\scripts\cpau.exe -u %computername%\%COMB% -p %PWord% -ex “cmd.exe /c” -lwp -wait -hide
ping -n 10 127.0.0.1>nul
rem creates folder structure on d drive using username
if not exist D:\Users\%COMB% md D:\Users\%COMB%
rem copies c drive profile to d drive
robocopy /copyall /mir /xj /r:1 /w:0 C:\Users\%COMB% D:\Users\%COMB%
rem deletes c drive profile
if exist D:\Users\%COMB% rmdir /s /q C:\Users\%COMB%
rem creates junction from c drive profile to d drive profile
if exist D:\Users\%COMB% mklink /J C:\Users\%COMB% D:\Users\%COMB%
UPDATED: Some other stuff I noticed (4/7/2014):
rem removes the lock overlay that appears after redirection
reg.exe delete “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\SharingPrivate” /f
REM THIS IS USED TO FIX THE PROFILE PATH IN THE REGISTRY. CHANGED FROM C DRIVE TO D DRIVE.
REM OTHERWISE A TEMP PROFILE MAY BE LOADED – WHICH ISN’T GOOD
set count=1
set REGKEY=
FOR /F “tokens=*” %%a IN (‘REG.EXE QUERY “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList”‘) DO (
if !count!==9 set REGKEY=%%a
set /a count+=1
)
reg.exe delete “%REGKEY%” /v ProfileImagePath /f
ping -n 4 127.0.0.1>nul
reg.exe add “%REGKEY%” /v ProfileImagePath /t REG_SZ /d D:\Users\%COMB% /f
remoteUser = ConsoleUser(“WorkstationNameHere”)
if remoteUser = “” then
msgbox “No User is Logged in”
else
msgbox remoteUser & ” is logged in”
end if
Function ConsoleUser(remoteHost)
‘ Returns name of user logged on to console
‘ If no users are logged on, returns “”
Dim oWMI, colProc, oProcess, remoteUser, sDomain
Set oWmi = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate,(debug)}!\\” _
& remoteHost & “\root\cimv2”)
Set colProc = oWmi.ExecQuery(“Select Name from Win32_Process” _
& ” Where Name=’explorer.exe’ and SessionID=1″)
ConsoleUser = “”
For Each oProcess In colProc
lRet = oProcess.GetOwner(remoteUser, sDomain)
If lRet = 0 Then
ConsoleUser = remoteUser
End If
Next
End Function
REM DOWNGRADE FROM 11 TO 10
REM PASS 1
FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-*11.*.mum /c “cmd /c ECHO Uninstalling package @fname && start /w pkgmgr /up:@fname /quiet /norestart”
REM PASS 2
wusa /uninstall /kb:2841134 /quiet /norestart
REM DOWNGRADE FROM 10 TO 9
REM PASS 1
FORFILES /P %WINDIR%\servicing\Packages /M Microsoft-Windows-InternetExplorer-*10.*.mum /c “cmd /c ECHO Uninstalling package @fname && start /w pkgmgr /up:@fname /quiet /norestart”
REM PASS 2
wusa /uninstall /kb:2718695 /quiet /norestart
This is how would stop the Windows Update Service from installing pending updates.
Just add to a script of your choice
sc stop wuauserv
sc config wuauserv start= disabled
c:
cd\windows\SoftwareDistribution
ren “Download” “Download_STOPPED”
takeown /f C:\Windows\winsxs\reboot.xml
takeown /f C:\Windows\winsxs\pending.xml
echo y|cacls C:\Windows\winsxs\reboot.xml /p everyone:f
echo y|cacls C:\Windows\winsxs\pending.xml /p everyone:f
del /q C:\Windows\winsxs\reboot.xml
del /q C:\Windows\winsxs\pending.xml
reg.exe delete “HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired” /f
reg.exe delete “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer” /v InProgress /f
How to fix missing user account names at login
The problem is when you launch Windows, there is no way to login – all the user accounts appear to be missing.
Go into Safe Mode (pressing F8 at boot up will get you there)
Login to an available profile
Start > Run > type cmd.exe [press enter]
Type the following commands:
REG.EXE ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{6f45dc1e-5384-457a-bc13-2cd81b0d28ed}” /t REG_SZ /d PasswordProvider /f
REG.EXE ADD “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{6f45dc1e-5384-457a-bc13-2cd81b0d28ed}\LogonPasswordReset” /t REG_SZ /d {8841d728-1a76-4682-bb6f-a9ea53b4b3ba} /f
To move the C:\Users folder to another hard drive (or partition), use robocopy and mklink to copy and perform a junction link. Note, don’t forget to use the /xj option robocopy (that tells the copy process to NOT follow junctions).
Step 1 – Type “robocopy /mir /xj C:\Users D:\Users” (Replacing the drive letters for your own) and hit “Enter”
This will copy all of your files from the original drive to the second drive.
Step 2 -Next, type “rmdir /s /q C:\Users” (Again, replacing drive letters)
This will delete the Users folder on the first drive
Step 3 -Next, type “mklink /j C:\Users D:\Users” (Replacing drive letters)
This will create the link between the two locations.
Now restart your computer, look in the C drive and you will see a short cut to the new location on your D drive. Any time Windows wants to use the Users folder in C it will get redirected to D.
This works for all new and existing users.