-
How can add and deploy basic batch via snapin from fog server? I was planning to run below batch script: (inside the script)
net user test password /add
net user test1 /delete
wmic computersystem where name=“%computername%” call rename name=“abc-Win10” -
I don’t use snapins but its pretty easy to import the batch script and make a snapin.
just save your code into a batch file, lets say configsys.cmd
Add those lines in like this"
@echo off net user test password /add net user test1 /delete wmic computersystem where name="%computername%" call rename name=“abc-Win10”
Then save the batch file.
Goto the new snapin page and set the snapin template to Batch script and then upload your script.That one is one of the simplest ones to create.
I would wonder if you are doing this after the fact, because there are ways to do this via the unattend.xml or fog client that might be easier then doing it post imaging.
-
@george1421 Please don’t take me wrong. I thought batch file should be saved as .bat format. Also, I am not familiar with unattend.xml. Would you be able to show me how? This is after the fact that user has moved to another desk and we have to add new user on that PC.
-
@msi Sorry maybe I wasn’t clear. Your batch file route can be saved as a .bat (but is probably better saved as a .cmd). You can deploy that as a snapin just as I had outlined.
The second part of my comment was to the reason why you are doing this. If you have to fix 100 computers that have already been deployed then the snap in route is the correct one. If you are doing this because you will deploy 100 computers in the future, then there may be another path you can take. One example is if you sysprep your reference image, then you can place batch commands in the c:\windows\setup\scripts directory. After windows setup is done, and before the login screen is presented to the user, windows setup looks in that path for a batch file called setupcomplete.cmd. If it finds that file it will run it before the user can login. There is also a way to have the windows unattend.xml file run commands or add users during its execution. Which can do the same things you are doing in your batch file.
These are all different ways to get the same results. The simplest is to create a batch file snapin like you talked about.
-
@george1421 just ran the snapin. it is not working… I checked the fog log, it saying some sort of Middleware response error. It just has a pause icon as below:
-
@msi I guess you need to post the errors in the log since the batch file is pretty simple. The developers may have to look into what is generating the middleware error.
-
@george1421 how can I do that?
-
@msi You looked in the fog client log [fog.log] to see the middle ware error on the client computer?
-
@george1421 I looked at the client (Karim-Win10) machine and c:\ drive. I guess, it’s a different issue. Should I start a new discussion?
-
@msi said in Run basic batch script on client machine via snapin:
wmic computersystem where name=“%computername%” call rename name=“abc-Win10”
I’m curious why you’d want to run the above command that I quoted. The FOG Client already will rename the system if you update the hostname in the web gui.
-
@wayne-workman I didn’t know that it could do that. Does it restart the machine afterwards? How can I verify that it changed the host name?
-
@msi said in Run basic batch script on client machine via snapin:
Does it restart the machine afterwards?
Yes. There’s options on how long the grace time for rebooting is, and the user has the option to cancel the reboot and then it’d just happen whenever it happens.
How can I verify that it changed the host name?
The new name will appear in Active Directory - and the computer will have a new name, so on… The rename feature is rock-solid, you don’t need to worry about checking on it. As long as the client-server encryption isn’t broke and the client can talk to the server, it’ll happen.
-
@wayne-workman Just tried, it works! thanks