[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

script needed

Posted on 2013-11-26
8
Medium Priority
?
347 Views
Last Modified: 2013-11-28
Hi Experts,

I need a script to copy two files from a share to my clients.
The files needed to be copied to the programfiles folder.
Before the copy, the script has to check if its a x86 or x64 system.

Any ideas ?
0
Comment
Question by:Eprs_Admin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 35

Expert Comment

by:Dan Craciun
ID: 39677897
Check if the folder Program Files (x86) exists.
If it does, copy the x64 version, if not, go for the x86 one

HTH,
Dan
0
 

Author Comment

by:Eprs_Admin
ID: 39678095
I need a script for it.
The script should check it like:

wmic os get architecture

and the result should of it should decide to install into folder x64 or x86.

How to do this via batch script
0
 
LVL 35

Assisted Solution

by:Dan Craciun
Dan Craciun earned 800 total points
ID: 39678145
$serverPath = "\\path\to\server"
$localPath = "X:\local\path"

if ((Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq "64-bit") {
  Copy-Item $serverPath -Destination $localPath"\x64\"
}
else Copy-Item $serverPath -Destination $localPath"\x86\"


Not tested, but should get you started.
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 

Author Comment

by:Eprs_Admin
ID: 39678179
I have seen, this is powershell.
How to do this in DOS as batch file?
Because the clients don´t have PS installed
0
 
LVL 35

Accepted Solution

by:
Dan Craciun earned 800 total points
ID: 39678213
What OS are your clients on? Powershell is installed on Windows 7 by default.
0
 
LVL 14

Assisted Solution

by:ThomasMcA2
ThomasMcA2 earned 400 total points
ID: 39678456
Try this:

@echo off

set serverPath = "\\path\to\server"

if exist "C:\Program Files (x86)" (
   set localPath = "C:\Program Files (x86)"
) else (
   set localPath = "C:\Program Files"
)

copy %serverPath% %localPath%

Open in new window

0
 
LVL 57

Assisted Solution

by:Bill Prew
Bill Prew earned 400 total points
ID: 39678457
Give this BAT a try, updating the files to copy.

@echo off

for /f "skip=2 tokens=2 delims=," %%A in ('wmic os get osarchitecture^,version /format:csv') do (
  if "%%A" EQU "64-bit" (
    set DestDir=C:\Program Files (x86)
  ) else (
    set DestDir=C:\Program Files
  )
)

copy "\\server\share\file1.txt" "%DestDir%"
copy "\\server\share\file2.txt" "%DestDir%"

Open in new window

~bp
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 400 total points
ID: 39678801
BTW is this a domain environment, have you tried out group policy preferences, you can easily target x64 and x86 differently and push down files,registry, apps etc....  

Steve
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question