add shortcut to website on multiple computers VIA script or software - batch-processing

I have several computers that I have to add a desktop shortcut to. The shortcut is just a link to a web URL. I'm wondering how you would code this in a batch script?
I can access each computer via network path and they are all kiosks, so the user is the same on them.
I imagine the code would be something like this...
PSEUDOCODE
create [shortcut to application (IE)][url] on [computer name 1][path to desktop]
create [shortcut to application (IE)][url] on [computer name 2][path to desktop]
create [shortcut to application (IE)][url] on [computer name 3][path to desktop]
etc...
Any ideas?
I'm also open to using software tools that make this process a little easier too.

You can use xcopy or Robocopy.
xcopy:
xcopy /E /I /Y "\\TOKEN\Deploy\Shortcuts" "%PUBLIC%\Desktop"
Robocopy:
robocopy.exe "\TOKEN\Deploy\Shortcuts" "%PUBLIC%\Desktop" /MIR

Related

How to restore a database from bak file from azure data studio on Mac

Previously on Mac I use mysql operation studio and I click on database and click restore then browse to my bak file, but now they change to azure data studio and when I repeat the same steps I got this error:
"You must enable preview features in order to use restore"
but I cannot figure out hot to enable that. I have googled and tried few things even open my azure, microsoft account on website but I do not see that option.
Can some one help please !
Go to Azure Data Studios > Settings
Edit settings by clicking on
"new settings editor"
Search for "preview"
Scroll to the bottom and
check "Enable unreleased preview features"
Adding this as an answer as I don't have enough rep to comment. This is in response to the question in the comment for the answer to the OP (If that's not confusing enough!)
This only applies when your sql database is hosted on a Mac/Linux/Docker Container. We don't have any Windows servers in our estate for me to test this on to see if the location of the .bak files is any different.
When you click on the "..." button, it browses to /var/opt/mssql/data on the machine (or docker container) the database is hosted on. This is not an issue if you are backing up & restoring databases on the same host, however, if you're migrating to a new server or just creating a dev/UAT/staging environment, it becomes a problem because you don't have access to var/opt/mssql/data.
This is a bit of a sledgehammer to crack a nut type solution but as I'm working with 2 dev boxes, it doesn't make a lot of difference to me.
To make this easier to understand I'll call the server that hosts the database you have backed up ProdServ & the server you are restoring to DevServ.
On DevServ, at a terminal prompt, navigate to /var/opt and make a note of the current permissions on the mssql directory (mine were drwxrwx---).
$ cd /var/opt
$ ls -la
Google the octal value for your permissions (in my instance, it's 770)
Change the permissions of the data directory to rwxrwxrwx.
$ chmod -R 777 /var/opt/mssql/data
(You will also need to do this on ProdServ if that is also a Unix-based o/s)
Copy the .bak files from ProdServ to DevServ via a method suitable to the environment you're working in.
Windows --> Linux I'd use WinSCP
For Mac to Docker, docker cp <fileToCopy> <container>:<destinationPath> works perfectly fine.
Once the files have been copied over, they will magically appear when you click the "..." button in azure data studio again. Make sure you change the directory permissions back to their original value via the same command. So in my instance, simply
$ chmod -R 770 /var/opt/mssql/data
As an extra note, if you're used to working in MSSMS, the wizard there allows you to create a database from a .bak file, from what I can see, Azure Data Studio does not. You have to create the database first (CREATE DATABASE <databasename>) in a query window, then restore the .bak file to it.
simple add this to your setting file:
"workbench.enablePreviewFeatures": true
You can click on View at the top menu next to Window.
Then select the first option Command Palette
Then in the command textbox type Restore and select Restore
Then the restore window comes up.

robocopy /b access denied

I'm going nuts over Robocopy. I want to create a 1:1 exact copy (including data, and permissions of each file & folder) of two local volumes. Actually, they are located on different physical HDD's. Say I have A:\ and B:\. I just want to copy all of the stuff from A:\ to B:\.
So, I tried this command:
robocopy A:\ B:\ /e /b /copyall /dcopy:T
But I keep getting access denied errors. Same results with /zb switch. I am using elevated/admin privileges in Win7 to run the Robocopy commands in command prompt.
I found a Microsoft hotfix, which fails to install on my machine, not sure if it would remedy my problem (KB979808).
I don't know if the problem is the commands, Robocopy itself, or the operating system.
Any ideas?
For whatever reason, right-clickind and running the command as Administrator doesn't work, but if you go into safe mode, the command works fine - you have admin rights.

Running a program at login as admin

I have a program I wrote in Visual Basic Express 2013 to put a classification banner at the top of the screen. I set up a scheduled task using ngen.exe which makes it run at login. The problem is that it doesn't run as admin so any non-privileged user can kill the task.
This program is to replace another program called Netbanner because there are a few issues with Netbanner. The program I wrote resolves all of these issues except for the admin issue. Netbanner is implemented exactly the same way (ngen.exe) but it won't let a non-privileged user kill the task.
I don't know if it is something in the program itself or I missed something in the deployment process.
This is the command used to deploy Netbanner which I duplicated to deploy mine:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install "C:\Program Files\Microsoft\NetBanner\NetBanner.exe"
Also, these are the files in C:\Program Files\Microsoft\NetBanner:
NetBanner.exe
NetBanner.InstallState
NetBanner.pdb
NetBannerSchTask.xml
Any ideas?
Thanks.
You could try to go into the properties->Compatibility->Run this program as an administrator for the application.
Alternatively, you could do the same thing for a batch file that you can schedule to run on startup.

Using WinSCP script for SFTP access from SSIS

I am new to WinSCP and am attempting to create a script file that will eventually be used with SSIS to download files from an SFTP site. A lot of the literature WinSCP includes explains the file downloading or uploading portions. For the time being, I just want to create a script to test the connection first and will build from there.
So far I saved the connection in WinSCP and have the following. The below code does not seem to function at all and I am not sure where else to go as I am still reading about the scripting for WinSCP. Is there a way or can someone point me in a direction to see if I am in fact connecting via through the script?
option batch on
option confirm off
open username#address
exit
Not sure what SSIS is (sorry) but I can tell you how I'd set it up from a windows batch file if that helps:
If you are open to using a different software, consider using cygwin. It mimics a linux shell so linux users on windows have a lot of linux utilities handy. That being said, there are some commands which can run on windows straight from command prompt (and thus batchable). What you'd need to do:
1) install cygwin
2) Create a "passwordless" login (using ssh-rsa authentication). To do this start your cygwin terminal and use the commands "ssh-keygen" and "ssh-copy-id" (more on that later)
3) Now you can run "sftp" from the DOS command prompt (does not require cygwin terminal) and sftp to your account. No password required because of step 2).
A few follow up info:
What can run from dos command prompt and what must be run from cygwin terminal?
If you go to the "bin" directory of cygwin (for me it's in c:\cygwin\bin) you can see all the cygwin utilities. Anything with "exe" extension can be run from dos command prompt. If no "exe" extension, must start cygwin terminal first
How to set up ssh-rsa authentication?
You can pretty much google "ssh login without password" and pull up a lot of results. This is common for setting up login from one linux system to another. You would be using the same steps using cygwin on windows. My instructions are here:
http://geekswing.com/geek/unix/how-to-ssh-login-without-a-password-using-ssh-keygen-quick-tutorial/
Storing session settings in WinSCP GUI and trying to access them from WinSCP script running in SSIS is generally a bad idea. I believe there's no example or guide on WinSCP site that would suggest doing that.
WinSCP stores its configuration in registry in HKEY_CURRENT_USER hive. The SSIS typically runs under a dedicated system account, that have its own HKEY_CURRENT_USER hive, and won't see the GUI configuration.
For details see WinSCP FAQ about your problem:
https://winscp.net/eng/docs/faq_scheduler
The best you can do is isolate your your script from configuration by using the session URL with the open command, instead of the stored site name.
See also https://winscp.net/eng/docs/scripting#configuration
Your actual problem can be completely different though. But that's hard to guess as you have not shared any details, such as error message, log file, etc.

How to run a CruiseControl task as an administrator in Windows Server 2008

I'm currently using CruiseControl.NET to automate my build. We have two different ways to build a solution in my build environment - one is through the Keil uVision4 IDE, the other is through Visual Studio 2008.
I've successfully gotten the Visual Studio solution to build properly using CruiseControl.NET and have created a batch file which properly uses Keil's uVision command line interface to compile my uvproj Project (compilation details here).
Problem Description
1) I can successfully execute the build script on my Windows 2008 server and build the project if I create a command prompt with administrator privileges (I'm doing this manually - start -> run -> cmd with ctrl-shift-enter to run as admin).
2) However, if I create a command prompt without administrator privileges, and attempt to execute the batch file, the batch file won't work unless I accept the prompt asking me to confirm admin rights are required to run the batch script.
How do I automatically execute a batch file as an administrator through CruiseControl?
Is this something that could be automated using the RunAs command?
Technical details
1) The batch file being executed is pretty simple - it deletes the old output and re-makes the output, creating a build log file in the location below.
set BuildLogLocation=BuildLog\BuildLog.txt
echo on
cd ../..
cd PTM
rmdir /s /q output
mkdir output
mkdir BuildLog
C:\Keil\UV4\UV4.exe -r myProj.uvproj -o %BuildLogLocation%
echo ErrorLevel of build is %ERRORLEVEL%
echo build complete, see %BuildLogLocation%
2) Currently I'm looking to use the Exec functionality to run the Keil build script above:
<Exec>
<Command>C:\myProject\Build\KeilBuild\BuildScript.bat<Command/>
<buildTimeoutSeconds>600<buildTimeoutSeconds/>
<!-- Details about error codes can be found here:
http://www.keil.com/support/man/docs/uv4/uv4_commandline.htm -->
<successExitCodes>0,1</successExitCodes>
<Exec/>
Related questions:
How can I use a build server with Keil uVision4 (MDK-ARM), script a build, use a makefile? (Electrical Engineering)
Execute a command-line command from CruiseControl.NET (Stack Overflow)
Can you run CCService, the CruiseControl.NET Windows Service, as a user who has administrative permissions? I'd try that first.
If that doesn't work, I would use runas to run your script. You'll have to embed the administrative user's password in the script calling runas.
I know this is old but, Did you get an offical way to do it Via Cruise Control?
Normally I create this and call it to call other processes "As Admin".
Make a ".VBS" script with This in the contents:
Dim strBatchPath
strBatchPath = "PATH-TO-FILE.EXE"
Set runBatch = CreateObject("shell.application")
runBatch.shellexecute strBatchPath,,,"runas",1
That could be an option to people that can't find an official way
You could try psExec from sysinternals. If you don't need to run as a nt-authority account you should be able to use this in the same way as runas.
It allows you to pass in the username/password as a switch (if memory serves)
I have Discovered that when using PSEXEC and using the -h switch, it then "runs as admin" on destination
e.g.
psexec -h \ServerToRunOn /accepteula -u DOMAIN\USER -p PASSWORD "PATH-TO-FILE"
I am Using CC.Net to call a batch file with the above in. This will run that file as Admin