Using Powershell to Move & Rename a File

I was wondering if there is a powershell script I could run as a scheduled task that will perform the following:
Move file from "C:\Program Files (x86)\NCSOFT\Aion\Chat.log"
To "C:\Users\Longstone\Documents\Aion Logs\Chat Log"
Rename the Chat.log in the new location to yearmonth.log (e.x.200910) or any similar descriptive name
Thanks in advance.

Hi Nick,
The { } indicate a string formatting placeholder, and the 0 means the first placeholder. The -f is PowerShell's format operator, and the get-date cmdlet returns the current date. The get-date cmdlet is enclosed in ( ) in order to make PowerShell evaluate it
as an expression.
Since you are new to PowerShell, I recommend two books: Windows PowerShell in Action by Bruce Payette and
Windows PowerShell Cookbook by Lee Holmes.
HTH,
Bill
Hey AbqBill,
How do you run this from the command line?
I've tried this in a batch file:
powershell move-item "\\NetworkLocation\ST\Backup.rar" ("\\NetworkLocation\ST\{0:yyyy_MM_dd}.rar" -f (Get-Date))
and it does not work, returns the error:
Unexpected token ':yyyy_MM_dd' in expression or statement.
At line:1 char:140
+ move-item \\NetworkLocation\ST\Backup.rar (\\NetworkLocation\ST\{0:yyyy_MM_dd <<<< }.rar -f (G
et-Date))
    + CategoryInfo          : ParserError: (:yyyy_MM_dd:String) [], ParentCont
   ainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
====================================================================
What am I doing wrong? or missing?
Thanks

Similar Messages

  • How do I bulk upload documents using PowerShell and extract metadata from file name?

    I have a requirement to upload a bunch of documents into a document library. Based on the content type, the rules of updating the metadata is different...the one giving me trouble is to extract the metadata from the file name. If I have a file name like
    "part1_part2_part3.pdf" how do I extract part1, part2, part3 and tag each document being uploaded into SharePoint, using PowerShell? I have searched and have not been able to find anything to get me started.
    Has anyone done this before? Or is there a blog I can take a look at? Thanks
     

    You will have to write a PS script encompassing this logic.
    Read files from the folder using
    Get-Item cmdlet
    Determine the content type based on the path or filename.
    Split the file name to extract the tag names.
    If the metadata fields in the content type is a managed metadata field, check whether the term exists and set it.
    Updating SharePoint Managed Metadata Columns
    with PowerShell
    This post is my own opinion and does not necessarily reflect the opinion or view of Slalom.

  • Using powershell to move a sub-site tree to a new site collection

    I have a case where I may need to move a subsite tree from one site collection to another existing site collection.
    The information I have normally seen on the web talks about creating a new site collection when moving a subsite tree.
    If I am going to an existing site, then can I still do the export and import or do I need to do something else.
    The manage content option is not available to me - the publishing infrastructure is not turned on the source site collection and the ramifications of turning it on are too great.
    I can use powershell to perform this move.
    Another situation is that the destination site collection has the SP 2010 visual upgrade, but this subsite tree does not yet have that turned on. I presume that it would be best to turn it on before I move - is there a way via powershell to turn on the visual
    upgrade for a subsite tree only? I don't want to turn it on the sibling trees at this time.

    Okay, after more web research, I see examples where I have to create a destination site before I import to it.
    So, here's what I tried.
    Export-spweb -Identity
    http://myfarm/sites/e/dprojects6/CC-Sharing/ -Path d:\temp\export_cc.bak -includeusersecurity –includeversions All –usesqlsnapshot
    # What template is the site?
    $web = get-spweb http://myfarm/sites/e/dprojects6/CC-Sharing/
    Write-host “Web Template:” $web.WebTemplate ” | Web Template ID:” $web.WebTemplateID "| Web Configuration:" $web.Configuration
    $tmp=$web.WebTemplate + "#" + $web.Configuration
    write-host "template:" $tmp
    New-SPWeb http://myfarm/sites/e/dprojects4/CC-Sharing -Template $tmp
    import-spweb
    http://myfarm/sites/e/dprojects4/CC-Sharing/ -Path d:\temp\export_cc.bak -includeUserSecurity
    What I ended up with was the imported data at
    http://myfarm/sites/e/dprojects4 instead of in
    http://myfarm/sites/e/dprojects/4/CC-Sharing/ .
    I am working on recovering things so I can try this again. It is not obvious to me what
    I did to cause the results I had.
    When I look in the import log I see:
    [3/18/2014 7:30:14 AM] Progress: Starting content import.
    [3/18/2014 7:30:14 AM] Progress: De-Serializing Objects to Database.
    [3/18/2014 7:30:14 AM] [Web] [CC-Sharing] Progress: Importing
    [3/18/2014 7:30:14 AM] [Web] [CC-Sharing] Verbose: Importing Web
    http://myfarm/sites/e/dprojects4/CC-Sharing.
    [3/18/2014 7:30:14 AM] [Folder] [] Progress: Importing
    and yet when I went to
    http://myfarm/sites/e/dprojects4/ I found the contents of CC-Sharing.
    Does this kind of thing sound familiar to anyone?
    Thank you all for your help.

  • Using a script to rename a file from the file info cart Cut Num (ID)??

    Hi,
    Can any of you guys tell me if its poss to do a script to rename a wav with the file info, cart, Cut Num ID field....??? (Cart chunks)
    Example file at the moment is called {C5E5F0FE-57D9-4A9A-8DA1-58D1AE7017FD}.wav and I want to grab the info out of the File info, cart section, under Cut Num (ID) which has 9558 in it and rename the file so it is now 9558.wav when it saves or just renames it.I also then want to run the script as i have 6000 plus wav,s to do this too.
    Thanks for any info.
    Glen

    >Can any of you guys tell me if its poss to do a script to rename a wav with the file info, cart, Cut Num ID field....??? (Cart chunks)
    No, scripts in Audition won't let you do this at all. In fact, Audition's scripting function really isn't very file-friendly, relating pretty much just to basic Audition functionality. And there's no way that an Audition script would let you rename a file anyway - they the closest they get to handling any file-related functions is that you can open a designated noise reduction profile - but that's about it.
    There's one place that I know of where you might find a utility to do what you want -
    here (try WidgetPro).

  • Windows Server 2008 R2: Using PowerShell to send a MSI file to all workstations

    Hello!
    We are currently using Windows Server 2008 R2. In the upcoming months, we are releasing new software. Instead of touching all the machines with gpupdate /force, we would like to know if we could somehow use Windows PowerShell and send that
    command to all the computers in our organization? We are currently in the process of using Group Policy Management to set up the new GPO. After we create them, we would like to send the MSI file to all workstations. I know it is SUPER easy to do within Windows
    Server 2012... as I have read articles and seen screenshots. I am just having a hard time figuring out how to make it work with Windows Server 2008 R2.
    Thanks!
    Megan

    New-PSSession -computername Computer
    where Computer is one of your remote computers.  If that succeeds, great!  But I'm guessing it won't and enabling that on all of your computers would require more effort than what you're trying to accomplish in the first place.
    Psexec is free to download and you don't have to deploy it:
    http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
    As far as identifying your target computers, it really depends on your environment.  Get-ADComputer is effective, but the example I provided above would get literally every computer in your active directory - is this something you want to deploy to
    any and all servers, workstations, etc?  How big and complex is your AD?  Is this something you need to coordinate with all your systems around about the same time, or can it be staggered?  Do you expect your target computers not to reboot between
    now and then?  I know that's a lot of questions, but your question is loaded and not easy to answer without knowing more about your environment.
    What about this?
    http://technet.microsoft.com/en-us/library/jj134201.aspx
    There is a requirement to have certain firewall exceptions on your target systems, but hopefully they are because that is the best approach.
    I hope this post has helped!

  • Can't move/delete/create files on external drive created with windows xp

    A friend of mine bought a brand new Maxtor External Hard drive. I connected it to my Windows XP machine and formatted it with NTFS and dumped 80Gig folder of data onto it.
    When he took it home and plugged it into his Mac G5 running Tiger, it see's the firewire drive and accesses the folder, but he can't delete/move/rename/create files and folders on that drive.

    I came across the same problem as well recently. I have thought about it for a long time but did not put it into practice. Yesterday I did it.
    1) Copying my data in XP disk out into my Powerbook which cost me a lot of time to wait
    2) In Windows XP, using Partition Magic (7.0) to delete the partition format of that disk (using the other tools should work as well)
    3) Plug this empty disk into my Powerbook, then it prompted that I need to format it or something like that
    4) Using Disk Utilities to format the disk as MS-DOS File Systems (FAT 32)
    5) Moving the original data into the new formatted disk which could be read and written by both Powerbook and PC.
    Everything is done! This is only my personal experience, not a general solution plan for this problem. Cheers all!
    Powerbook G4 17"   Mac OS X (10.4.8)   1.67GHz, 2GB DDR2, 120GB, SuperDrive, 128MB ATI Mobility Radeon 9700
    Powerbook G4 17"   Mac OS X (10.4.7)   1.67GHz, 2GB DDR2, 120GB, SuperDrive, 128MB ATI Mobility Radeon 9700

  • Moving and renaming image files

    I want to move & rename image files to folders on the hard drive by dragging and dropping them into my application. I read about the problem with renameTo() method with windows. Is this possible to do in java? I heard about a method in which you read,write and delete the old file? How do I go about making this happen?

    Well, what happens if you create the folder C:/Test/testfile1.txt ?
    Or alternatively remove the part that says "testfile1.txt" from the directory path in your program.
    Or alternatively call dir.mkdirs() before trying to rename.
    What I am getting at is that when you create a file with the constructornew File(dir,newdest.getName())the parameter dir is treated as a directory no matter what its name is. If its name is "C:/Test/testfile1.txt," the name of the new file will be "C:/Test/testfile1.txt/name_of_newdest"where name_of_newdest is the name of the "newdest" file. This might not be what you wanted

  • Windows Server Backup Using Powershell

    Hi
    Am using the VSS to backup some directory to shared path. I want to backup again , at the time only backup modified files or new files, not all completely.
    ( differential backup )
    add-pssnapin windows.serverbackup
    $policy = New-WBPolicy
    $fileSpec = New-WBFileSpec -FileSpec D:\old\*.*
    Add-WBFileSpec -Policy $policy -FileSpec $filespec
    $backupLocation = New-WBBackupTarget -NetworkPath \\xxxxx\Shared\
    Add-WBBackupTarget -Policy $policy -Target $backupLocation
    Set-WBVssBackupOptions -Policy $policy -VssCopyBackup
    Start-WBBackup -Policy $policy
    If you have realated to that cmdlet , please share it here.
    Thanks in advance .
    Karpahasundaram M.

    Hi Karpahasundaram,
    If you want to Back Up Modified Files to a Network location, please try to filter the files in a directory with the "lastwritetimeItem" property, then use the cmdlet "Copy-Item" to copy files.
    Get-ChildItem c:\data -Recurse | where {!($_.psiscontainer) -AND $_.lastwritetime -gt (get-date).date} | ForEach {
    Copy-Item -path $_.fullname -destination \\hyperv1\shared\backup}
    Reference from:
    Use PowerShell to Back Up Modified Files to the Network
    If I have any misunderstanding, please let me know.
    Best Regards,
    Anna

  • Powershell program to upload multiple files with version control at the file level

    I have a network folder which contains multiple files refreshed daily.I then run a power
    shell scrip which uploads all the files . I have scheduled it to run once
    daily. I have version control at the directory level , is there a way to upload all the files daily and maintain the last X versions for each file , rite now it does it at a folder level . I want it at a file level
    powershell script
    if((Get-PSSnapin "Microsoft.SharePoint.PowerShell") -eq $null)
    Add-PSSnapin Microsoft.SharePoint.PowerShell
    #Script settings
    $webUrl = "http://sharepoint.contoso.com/Corporate/Sales/"
    $docLibraryName = "Shared Documents"
    $docLibraryUrlName = "Shared Documents\arizona" # specify your subfolder url here
    $localFolderPath = "C:\Test"
    #Open web and library
    $web = Get-SPWeb $webUrl
    write-host $webUrl
    $docLibrary = $web.Lists[$docLibraryName]
    write-host $docLibrary
    $files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles()
    write-host $files
    ForEach($file in $files)
    if($file.Name.Contains(".pdf"))
    write-host $file
    #Open file
    try
    $fileStream = ([System.IO.FileInfo] (Get-Item $file.FullName)).OpenRead()
    #Add file
    $folder = $web.getfolder($docLibraryUrlName)
    write-host "Copying file " $file.Name " to " $folder.ServerRelativeUrl "..."
    $spFile = $folder.Files.Add($folder.Url + "/" + $file.Name,[System.IO.Stream]$fileStream, $true)
    write-host "Success"
    #Close file stream
    $fileStream.Close();
    catch
    Write "Error: $file.name: $_" >>c:\logfile.txt
    continue;
    #Dispose web
    $web.Dispose()

    Check if this helps you
    http://blogs.technet.com/b/heyscriptingguy/archive/2013/04/28/weekend-scripter-use-powershell-to-upload-a-sharepoint-file-version.aspx
    # Add the Snapin
    Add-PSSnapin Microsoft.SharePoint.PowerShell
    # Retrieve specific Site
    $spWeb = Get-SPWeb http://SP01
    # Create instance of Folder
    $spFolder = $spWeb.GetFolder("Shared Documents")
    # Get the file on Disk that we want to upload
    $file = Get-Item C:\Documents\MyDoc.docx
    # upload the file.
    $spFolder.Files.Add("Shared Documents/MyDoc.docx",$file.OpenRead(),$false)
    $newVersion = $spFolder.Files.Add($spFile.Name, $file.OpenRead(), $spFile.Author, $spFile.ModifiedBy, $spFile.TimeCreated, (Get-Date))
    If this helped you resolve your issue, please mark it Answered

  • Renaming typedef file caused constants reset

    Hello!
    Here's a short description of the problem I encountered:
    I renamed the filename of the typedef that was used in my state machine for state coding (see for example State Machine template shipped with LV). As result I lost values of ALL constants that coded states in my state machine, i.e. they were reset to value of the first value in state enum.
    Note: when opening state machine that used the typedef
    I got the message something like "VI was changed in memory. Reload from disk or view from the memory?". And 2 buttons: View and Discard. I clicked "View".
    Then after restoring all constants manually, I saved my work to archive and tried to rename typedef file again, the result was the same - all constants reset to first value of enum.
    I restored files from archive, again renamed typedef file,
    then closed my app WITHOUT saving state machine that used typedef. After opening my program I got the message "Searching for my typedef", pressed "Browse..." and loaded typedef from renamed file. Constants were left without any change (uh-r-r-a!).
    Before posting this message to forum I tried to make an example to show the problem, but o-o-ps I failed to do it.
    It didn't repeat even with my program.
    This post can't be considered as bug report, as I can't repeat the problem. But I think the problem exists as I lost values of all constants after renaming typedef file, and this is the fact.
    So my advice (that old as the world) to everybody is to save work even when innocent actions are made such as renaming typedef file names.
    Probably somebody encountered this problem and knows how to repeat it.
    Thanks for attention.
    Any comments appreciated.
    Rashid.
    Using LV 8.0 (LV Run Time Engine 8.0.1) on Win XP with Russian locale, all VIs used in my programs have names in cyrillic sometimes mixed with english letters, e.g. "russian name (typedef).ctl".

    Hello, Charlie,
    I can say absolutely sure that I always used LabView to rename my typedef file. I never use Windows Explorer to rename typedef files (or any other LV files) in my practice.
    Besides, when the values of my constants were reset there wasn't any broken wires. The block diagram wasn't corrupted. Everything was fine except default values of my constants. Due to that I noticed this error a little later - after renaming typedef file I ran my program and couldn't understand why it fails to act as should. When debugging this problem I went down to my state machine and only then I saw that all my state constants are reset to default values.
    I never used "Substitute copy for original". I used only
    "Rename" when renaming my typedef file.
    I didn't add any items to my typedef. The only things I did are:
    - renaming my typedef enum label in the *.ctl file;
    - and "Save as.." -> "Rename..." - renaming my typedef file.
    Besides, when I did try renaming 2nd time to reproduce such behaviour: I left typedef enum label without change and the behaviour was the same.
    So, such behaviour (loosing constant values) I get TWO times.
    But after I worked around this (see 1st post) I couldn't already reproduce this behaviour.
    If I'll succeed in this one more time again, and be able to reproduce this behaviour, I'll certainly post to you my steps.
    Thanks for attention.
    Rashid.
    P.S.
    1. As to broken wires if I get it right - in your case you added new items to typedef but your case structure in state machine was not updated to contain new states handlers. If so, then it's obvious why you got broken wires. But as I didn't change the typedef itself (only renamed it), I didn't get broken wires.
    2. I wouldn't be surprised if I'd have done something in the weird way: I mean renaming by Explorer or saving, closing and so on. I was doing everything from the LabView environment. As far as I remember I didn't rename the state machine vi file at that, only typedef file. And my state machine was always opened. The only file I was opening/renaming/closing was typedef file. And as far as I remember I opened it by "File -> Open..." and not right-clicking at constant and "Open TypeDef..".
    3. I understand that my description is foggy :-) and that it's difficult to find this weird set of steps, but who knows. Anyway I appreciate your help.Message Edited by Rashid on 06-13-2006 12:03 PM

  • Backup NOT Move imovie 08 files

    I'm going to use an external drive and use Imoive to move and process my Imovie 08 events however I also want to make a backup copy of my Event files, not the Project files, to a separate external drive in case the main external drive fails. I've used Finder to move the Event files and and the events seem to play fine on the backup external drive.
    Will I be able to use these backup Event files to create a new project if necessary? I understand that the original Projects will not be linked to them and would have to be redone.
    Thanks.

    What is imovie error -34? It occurs when trying to create the movie for media browser?
    Copying "Events" using the Finder will "orphan" any projects currently being processed. To prevent this, Event clips must be moved within the running application to update reference pointers. Files/folders copied at the Finder level to an external drive must be in an "iMovie Events" folder at the "root" level of the external drive to be recognized at all and will only be "scanned" during the initialization of the iMovie '08 application as it opens. Thus, it is possible to create/move Event clips externally but only if you plan to manually correct the project "resource" pointers for "active" projects. Personally, I find it saves a lot of time and effort to work within the application and let it take care of such tasks.

  • [SOLVED] - How to Rename a Win 7 Computer Using Powershell (deployment)

    For those who just want to know what I'm trying to do here's my question:
    How I can programmatically rename machines during the auditSystem/auditUser portion of Sysprep using PowerShell?
    What is the exact command and/or function should I be issuing?
    History:
    I've scoured the web for a while but unsuccessfully located what I was looking for.  I'm preparing a Windows 7 Enterprise x86 image for deployment, and I need to rename the machine to match our current PC name schema before it is joined to the domain. 
    I've managed to pull the information I needed to build the corret computer name thanks to Win32_BIOS.SerialNumber, Win32_ComputerSystem.Model and some IP<->Hashtable Array matching.  The next step is to actually rename the machine; This is
    where I'm having trouble.
    I found this code online :
    Function Rename-ComputerName ([string]$NewComputerName){
    $ComputerInfo = Get-WmiObject -Class Win32_ComputerSystem
    $ComputerInfo.rename($NewComputerName)}
    I also found
    this code online :
    function renameAndReboot([string]$computer, [string]$newname){
    $comp = gwmi win32_computersystem  -computer $computer
    $os   = gwmi win32_operatingsystem -computer $computer
    $comp.Rename($newname)
    $os.Reboot()}
    Unfortunately, neither work in PowerShell on my reference image PC running Windows 7.  (However the first one works in PowerShell on my XP Virtual PC.)
    The ReturnValue is 1326 when run on the Win 7 machine as the Administrator.  I'm not quite certain I understand what & why that fails or what exactly that code means.
    Moving on, I decided to go down the WMIC path instead:
     WMIC ComputerSystem where Name="%computername%" call Rename Name="$NewName"
    This works in CMD.exe on Windows XP and to my surprise, in CMD.exe on Windows 7 as well!  But, when run from PowerShell I get "Error: Invalid query".
    Thinking PowerShell might not like the CMD.exe %COMPUTERNAME% environment variable, I sprang for the PowerShell $env:computername environment variable instead:
     WMIC ComputerSystem where Name="$env:computername" call Rename Name="$NewName"
    That unfortunately results in an 'Unexpected switch at this level' error.
    Other suggestions I've seen online were to use netdom, but that's not part of the Win 7 install and since I've historically been able to do this through WMI calls, it should be possible to do this in Win 7, Vista, Server etc.
    I'm completely open to the idea that perhaps I'm doing something wrong.  If you have a tested solution, please share.

    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="generalize">
    <component name="Microsoft-Windows-Security-SPP" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SkipRearm>1</SkipRearm>
    </component>
    </settings>
    <settings pass="specialize">
    <component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <RunSynchronous>
    <RunSynchronousCommand wcm:action="add">
    <Order>1</Order>
    <Path>net user administrator /active:yes</Path>
    </RunSynchronousCommand>
    </RunSynchronous>
    </component>
    <component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SkipAutoActivation>true</SkipAutoActivation>
    </component>
    <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <OEMInformation>
    <Manufacturer>Company Name</Manufacturer>
    <Model>Company Owned Hardware</Model>
    <SupportHours>Mon-Fri 8 AM - 8 PM Central Time; excluding Holidays</SupportHours>
    <SupportPhone>1-888-xxx-xxxx</SupportPhone>
    <SupportURL>http://our.support.url.information</SupportURL>
    <Logo>%WINDIR%\WallPapr2.bmp</Logo>
    </OEMInformation>
    <OEMWelcomeCenter>
    <link>http://our.helpdesk.information</link>
    </OEMWelcomeCenter>
    <ComputerName></ComputerName>
    <CopyProfile>true</CopyProfile>
    <ShowWindowsLive>false</ShowWindowsLive>
    <TimeZone>Central Standard Time</TimeZone>
    <ProductKey>FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4</ProductKey>
    </component>
    <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Identification>
    <Credentials>
    <Domain>domainname</Domain>
    <Password>password</Password>
    <Username>domainadmin</Username>
    </Credentials>
    <JoinDomain>domainname</JoinDomain>
    <MachineObjectOU>OU=OU Information,DC=com</MachineObjectOU>
    </Identification>
    </component>
    </settings>
    <settings pass="oobeSystem">
    <component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <InputLocale>en-us</InputLocale>
    <SystemLocale>en-us</SystemLocale>
    <UILanguage>en-us</UILanguage>
    <UserLocale>en-us</UserLocale>
    <UILanguageFallback>en-us</UILanguageFallback>
    </component>
    <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <AutoLogon>
    <Password>
    <Value>encrypted info</Value>
    <PlainText>false</PlainText>
    </Password>
    <Enabled>true</Enabled>
    <LogonCount>3</LogonCount>
    <Username>administrator</Username>
    </AutoLogon>
    <FirstLogonCommands>
    <SynchronousCommand wcm:action="add">
    <CommandLine>%WINDIR%\Setup\Scripts\NewPC1.cmd</CommandLine>
    <Description>Change Machine Name and Reboot</Description>
    <Order>1</Order>
    <RequiresUserInput>false</RequiresUserInput>
    </SynchronousCommand>
    <SynchronousCommand wcm:action="add">
    <CommandLine>%WINDIR%\Setup\Scripts\NewPC2.cmd</CommandLine>
    <Order>2</Order>
    <RequiresUserInput>false</RequiresUserInput>
    <Description>More Cleanup Work</Description>
    </SynchronousCommand>
    </FirstLogonCommands>
    <OEMInformation>
    <Manufacturer>Company Name</Manufacturer>
    <Model>Company Owned Hardware</Model>
    <SupportHours>M-F, 8 am - 8 pm Central excluding Holidays</SupportHours>
    <SupportPhone>1-888-xxx-xxxx</SupportPhone>
    <SupportURL>http://our.support.url.information</SupportURL>
    </OEMInformation>
    <OEMWelcomeCenter>
    <link>http://our.helpdesk.information</link>
    </OEMWelcomeCenter>
    <OOBE>
    <HideEULAPage>true</HideEULAPage>
    <NetworkLocation>Work</NetworkLocation>
    <ProtectYourPC>3</ProtectYourPC>
    </OOBE>
    <UserAccounts>
    <AdministratorPassword>
    <Value>encrypted info</Value>
    <PlainText>false</PlainText>
    </AdministratorPassword>
    <LocalAccounts>
    <LocalAccount wcm:action="add">
    <Password>
    <Value>encrypted info</Value>
    <PlainText>false</PlainText>
    </Password>
    <Description>Local Administrator</Description>
    <DisplayName>Administrator</DisplayName>
    <Group>Administrators</Group>
    <Name>Administrator</Name>
    </LocalAccount>
    </LocalAccounts>
    </UserAccounts>
    <RegisteredOrganization>Company Name</RegisteredOrganization>
    <RegisteredOwner>Licensed CompanyEmployee</RegisteredOwner>
    <TimeZone>Central standard Time</TimeZone>
    </component>
    </settings>
    <cpi:offlineImage cpi:source="wim:location/of/install.wim#Windows 7 PROFESSIONAL" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    Jnaas. My Answer file?
    I hope I didnt leave anything incriminating in that file...
    The product key is the generic one for Windows 7 to tell it to use the KMS server.

  • Using powershell to manipulate mapi profile and PST file locations

    I have a situation whereby I need to move a bunch of PST files out of the default location in Office 2010 and change the mapi profile for the user so that the pst file location updated so the user doesn't experience any issues when launching Outlook.
    My logic flow is as follows:
    1.) locate All pst files referenced in the logged on users MAPI profile.
    2.) Move these files to a another directory eg. c:\users\%username%\OutlookFiles
    3.) Update the MAPI profile to point to the new location so that when the user launches Outlook he doesn't notice that the files have been moved.
    I know how to copy the files using powershell etc. but how on earth do you query the MAPI profile to locate the pst files and then change each entry for a PST file to point to the new location.
    Anyone got any ideas?

    What you are trying to do cannot normally be done with a script due to a whole host of reasons including differences in versions and lack of access to a users profile.
    !. Are you on Exchnage?
    2. Have you redirected the users folders with Group Policy yet?
    Outlook OST files are not movable without the use of a third party tool.  It is far easier to just have the users create a new profile.
    PST files that are attached in a user session can be moved using a script that can be run by the user.
    ¯\_(ツ)_/¯

  • How to rename computer account using Powershell 2.0

    Hi,
    For my Win7 deployment environment i need a script that can rename my workstation and it's Active Directory computer account.
    Is this possible using Powershell 2.0 included in Win7?

    I created a PowerShell script that, among other things, renames the computer.
    Function Rename-Computer ([string]$NewComputerName) {
    $comp = (gwmi win32_computersystem).Name.Trim()
    $ComputerInfo = Get-WmiObject -Class Win32_ComputerSystem
    Write-Host "Renaming computer...`n`tOld name: $comp`n`tNew name: $apnewname"
    #Start-Sleep (10)
    $ComputerInfo.rename($NewComputerName) | Out-Null
    After that you should reboot
    function RestartMachine{
    $os = gwmi win32_operatingsystem
    $os.psbase.Scope.Options.EnablePrivileges = $True
    $os.Reboot()
    Or better yet just use the `Restart-Computer` cmdlet built into PoSH.
    Now, the original post also said there was a need to rename the computer object n AD.  Below are two functions I use primarily for moving AD objects into their appropriate OU home.  While that doesn't immediately answer the question or solve the
    problem, I do believe you can rename the object you bind to using a very similar method.
    # This was created with the idea that machines would join the
    # domain automatically, into a predetermined OU. From there,
    # we would determine which OU the machine should be in, then
    # move it by calling this function.
    function MoveOU ($newOU) {
    $comp = (gwmi win32_computersystem).Name.Trim()
    $dumpOU = "CN=Computers,"
    # DC=dc,DC=net
    $root = [adsi]""
    #CN=Computers,DC=dc,DC=net
    $srcOU = [adsi]("LDAP://"+$dumpOU+$root.distinguishedName)
    #OU=fixedOU,OU=testOU,DC=dc,DC=net
    $destOU = [adsi]("LDAP://OU=fixedOU,OU=testOU,"+$root.distinguishedName)
    #CN=COMPUTERNAME,CN=Computers,DC=dc,DC=net
    $admin = [adsi]("LDAP://CN="+$comp+","+$srcOU.distinguishedName)
    #$admin.psbase | get-member | where-object {$_.Name -eq "MoveTo"}
    #System.Void MoveTo(DirectoryEntry newParent), System.Void MoveTo(DirectoryEntry newParent, String newName)
    $admin.PSBase.MoveTo($destOU)
    Function Move-OU ($SiteDC, $newOU) {
    $computerName = (gwmi win32_computersystem).Name.Trim()
    $_computerType = "CN=Computer,CN=Schema,CN=Configuration,DC=dc,DC=net"
    $path = "LDAP://$SiteDC/DC=dc,DC=net"
    $domain = "domain"
    $user = "user"
    $pass = "password"
    $de = New-Object System.DirectoryServices.DirectoryEntry($path,"$domain\$user",$pass)
    $ds = New-Object System.DirectoryServices.DirectorySearcher($de)
    $ds.Filter = "(&(ObjectCategory=computer)(samaccountname=$computerName$))"
    $res = $ds.FindAll()
    if ($res.count -gt 0) {
    # Machine has been found
    # Bind to the Computer Object in AD
    $oldComputerObject = New-Object System.DirectoryServices.DirectoryEntry($res[0].path,"$domain\$user",$pass)
    #$oldOU = $oldComputerObject.distinguishedName
    $oldOU = $oldComputerObject.Path
    Else {
    $strFilter = "(Name=$computerName)"
    $objDomain = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$SiteDC/dc=dc,dc=net","$domain\$user",$pass)
    $objSearcher = New-Object System.DirectoryServices.DirectorySearcher($objdomain)
    $objSearcher.SearchRoot = $objDomain
    $objSearcher.PageSize = 1000
    $objSearcher.Filter = $strFilter
    $objSearcher.SearchScope = "Subtree"
    $colPropList = "distinguishedName", "Name"
    foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i) | Out-Null}
    $colResults = $objSearcher.FindAll()
    #$colResults.Count
    if($colResults.count -gt 0) {
    foreach($result in $colResults) { $target = $result.Properties }
    $Error.Clear()
    #$oldOU = $target.distinguishedname
    $oldOU = [string]$target.adspath
    Else {
    write-host "`tWARNING: Unable to locate $computername in AD; Cannot move to correct OU"
    ErrorLog "WARNING: Cannot move object $computername to correct OU; Not found in AD."
    $destOU = New-Object System.DirectoryServices.DirectoryEntry("LDAP://$SiteDC/$newOU","$domain\$user",$pass)
    $oldComputerObject.PSBase.MoveTo($destOU)
    /\/\o\/\/ who has been known to dabble in scripting a bit (;) has also covered this subject here.  I would copy & paste, but I highly recommend reading it to get a better understanding of what's going on.  Plus, there's LOADS of useful information
    on that site!
    http://mow001.blogspot.com/2006/09/powershell-active-directory-part-11.html

  • How to edit move rename files in iTunes

    how to edit move rename files in itunes

    I don't like iTunes.
    I don't want iTunes to keep the physical location of my files because they can be on a SD card, or an USB drive and i don't want iTunes to stop me from playing a song because it cannot find it anymore.
    So i would like to use physical files just to upload to iTunes Match and then delete the link to the physical file.
    If needed, iTunes Match will download the file.
    The problem is just that i would like to delete all references to physical files to make iTunes Match download the file only when needed and stop using the first version i had given to it
    maybe i could have a Apple Script to check if there is a physical file referenced and if so delete it to have only the Cloud version     

Maybe you are looking for